INNER CODE UNIT · Python

exec_subcommand

Yelp/paasta · paasta_tools/cli/cli.py:81

def exec_subcommand(argv):
    command = sys.argv[1]
    os.execlp(f"paasta-{command}", *argv[1:])


def add_subparser(command, subparsers):
    """Given a command name, paasta_cmd, execute the add_subparser method
    implemented in paasta_cmd.py.

    Each paasta client command must implement a method called add_subparser.
    This allows the client to dynamically add subparsers to its subparser, which
    provides the benefits of argcomplete/argparse but gets it done in a modular
    fashion.

    :param command: a simple string - e.g. 'list'
    :param subparsers: an ArgumentParser object"""
    module_name = "paasta_tools.cli.cmds.%s" % command
    add_subparser_fn = load_method(module_name, "add_subparser")

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…