How to use the argcomplete.shellcode function in argcomplete

To help you get started, we’ve selected a few argcomplete examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github databricks / spark-deep-learning / dev / run.py View on Github external
output_env.update(missing_env)

    if not missing_only:
        output_env.update(given_env)

    if configure:
        required_env = dict(given_env)
        required_env.update(missing_env)
        configured_env = _get_configured_env(required_env)
        output_env.update(configured_env)

    env_str = "#!/bin/bash\n"
    env_str += _env2shellcode(output_env)

    if auto_completion:
        env_str += argcomplete.shellcode(sys.argv[0])

    print(env_str)
    return 0
github elemental-lf / benji / src / benji / scripts / cli.py View on Github external
def completion(shell: str) -> None:
    print(argcomplete.shellcode(sys.argv[0], shell=shell))
github elemental-lf / benji / src / benji / scripts / benji.py View on Github external
def completion(shell: str) -> None:
    print(argcomplete.shellcode(sys.argv[0], shell=shell))
github k4cg / nichtparasoup / nichtparasoup / cli / commands.py View on Github external
def completion(shell: str) -> int:
        from sys import stdout
        from argcomplete import shellcode  # type: ignore
        stdout.write(shellcode(
            ['nichtparasoup'], shell=shell,
            use_defaults=True, complete_arguments=None,
        ))
        return 0
github vanyakosmos / argser / argser / __main__.py View on Github external
def autocomplete(args: AutoArgs):
    import argcomplete

    try:
        if args.executables:
            exs = extract_scripts(args.executables, args.mark)
        else:
            exs = find_scripts(args.mark)
    except FileNotFoundError as e:
        sys.stderr.write(f"{e}\n")
        return

    # noinspection PyTypeChecker
    print(argcomplete.shellcode(exs, args.use_defaults, args.shell, args.complete_arguments))

    print("added autocompletion to files (if you ran this with eval):", file=sys.stderr)
    for file in exs:
        print(f"- {file}", file=sys.stderr)
github edio / randrctl / randrctl / cli.py View on Github external
def cmd_setup_completion(args: argparse.Namespace):
    print(argcomplete.shellcode('randrctl', True, 'bash', None))
    return 0
github seznam / vindaloo / vindaloo / vindaloo.py View on Github external
def output_completion(self):
        self._out(argcomplete.shellcode(
            ['vindaloo'],
            False,
            'bash',
        ))