Did I find the right examples for you? yes no

All Samples(6)  |  Call(2)  |  Derive(0)  |  Import(4)
Adds support for shell completion via argcomplete_ by patching given
`argparse.ArgumentParser` (sub)class.

If completion is not enabled, issues a warning.  The warning is suppressed
either if the shell is not `bash` or if `allow_warnings` is `False`.
The latter can be due to the output stream not being a TTY.

        def autocomplete(parser, allow_warnings=True):
    """ Adds support for shell completion via argcomplete_ by patching given
    `argparse.ArgumentParser` (sub)class.

    If completion is not enabled, issues a warning.  The warning is suppressed
    either if the shell is not `bash` or if `allow_warnings` is `False`.
    The latter can be due to the output stream not being a TTY.
    """
    if COMPLETION_ENABLED:
        argcomplete.autocomplete(parser)
    elif allow_warnings and 'bash' in os.getenv('SHELL', ''):
        import warnings
        warnings.warn('Bash completion not available. Install argcomplete.')
        


src/a/r/argh-0.24.1/argh/dispatching.py   argh(Download)
                            ATTR_EXPECTS_NAMESPACE_OBJECT,
                            PARSER_FORMATTER)
from argh.completion import autocomplete
from argh.assembling import add_commands, set_default_command
from argh.exceptions import CommandError
    if completion:
        isatty = hasattr(output_file, 'isatty') and output_file.isatty()
        autocomplete(parser, allow_warnings=isatty)
 
    if argv is None:

src/a/r/argh-HEAD/argh/dispatching.py   argh(Download)
                            ATTR_EXPECTS_NAMESPACE_OBJECT,
                            PARSER_FORMATTER)
from argh.completion import autocomplete
from argh.assembling import add_commands, set_default_command
from argh.exceptions import CommandError
    if completion:
        isatty = hasattr(output_file, 'isatty') and output_file.isatty()
        autocomplete(parser, allow_warnings=isatty)
 
    if argv is None:

src/a/r/argh-0.24.1/argh/helpers.py   argh(Download)
import argparse
 
from argh.completion import autocomplete
from argh.assembling import add_commands, set_default_command
from argh.dispatching import PARSER_FORMATTER, dispatch

src/a/r/argh-HEAD/argh/helpers.py   argh(Download)
import argparse
 
from argh.completion import autocomplete
from argh.assembling import add_commands, set_default_command
from argh.dispatching import PARSER_FORMATTER, dispatch