예제 #1
0
def get_argparser():
    parser = ThrowingArgumentParser(
        description=
        ("The PaaSTA command line tool. The 'paasta' command is the entry point "
         "to multiple subcommands, see below.\n\n"
         "You can see more help for individual commands by appending them with '--help', "
         "for example, 'paasta status --help' or see the man page with 'man paasta status'."
         ),
        epilog=
        ("The 'paasta' command line tool is designed to be used by humans, and therefore has "
         "command line completion for almost all options and uses pretty formatting when "
         "possible."),
        # Suppressing usage prevents it from being printed twice upon print_help
        usage=argparse.SUPPRESS,
    )

    # http://stackoverflow.com/a/8521644/812183
    parser.add_argument(
        '-V',
        '--version',
        action='version',
        version='paasta-tools {}'.format(
            pkg_resources.get_distribution('paasta-tools').version))

    subparsers = parser.add_subparsers(help="[-h, --help] for subcommand help")
    # Adding a separate help subparser allows us to respont to "help" without --help
    help_parser = subparsers.add_parser('help', add_help=False)
    help_parser.set_defaults(command=None)

    for command in sorted(paasta_commands_dir(cmds)):
        add_subparser(command, subparsers)

    return parser
예제 #2
0
파일: cli.py 프로젝트: iomedhealth/paasta
def get_argparser():
    parser = argparse.ArgumentParser(
        description=(
            "The PaaSTA command line tool. The 'paasta' command is the entry point "
            "to multiple subcommands, see below.\n\n"
            "You can see more help for individual commands by appending them with '--help', "
            "for example, 'paasta status --help' or see the man page with 'man paasta status'."
        ),
        epilog=(
            "The 'paasta' command line tool is designed to be used by humans, and therefore has "
            "command line completion for almost all options and uses pretty formatting when "
            "possible."
        ),
    )

    # http://stackoverflow.com/a/8521644/812183
    parser.add_argument(
        "-V",
        "--version",
        action="version",
        version="paasta-tools {0}".format(pkg_resources.get_distribution("paasta-tools").version),
    )

    subparsers = parser.add_subparsers(help="[-h, --help] for subcommand help")

    for command in sorted(paasta_commands_dir(cmds)):
        add_subparser(command, subparsers)

    return parser
예제 #3
0
def get_argparser():
    parser = ThrowingArgumentParser(
        description=(
            "The PaaSTA command line tool. The 'paasta' command is the entry point "
            "to multiple subcommands, see below.\n\n"
            "You can see more help for individual commands by appending them with '--help', "
            "for example, 'paasta status --help' or see the man page with 'man paasta status'."
        ),
        epilog=(
            "The 'paasta' command line tool is designed to be used by humans, and therefore has "
            "command line completion for almost all options and uses pretty formatting when "
            "possible."
        ),
        # Suppressing usage prevents it from being printed twice upon print_help
        usage=argparse.SUPPRESS,
    )

    # http://stackoverflow.com/a/8521644/812183
    parser.add_argument(
        "-V",
        "--version",
        action="version",
        version="paasta-tools {0}".format(pkg_resources.get_distribution("paasta-tools").version),
    )

    subparsers = parser.add_subparsers(help="[-h, --help] for subcommand help")
    # Adding a separate help subparser allows us to respont to "help" without --help
    help_parser = subparsers.add_parser("help", add_help=False)
    help_parser.set_defaults(command=None)

    for command in sorted(paasta_commands_dir(cmds)):
        add_subparser(command, subparsers)

    return parser
예제 #4
0
def get_argparser():
    parser = argparse.ArgumentParser(
        description=
        ("The PaaSTA command line tool. The 'paasta' command is the entry point "
         "to multiple subcommands, see below.\n\n"
         "You can see more help for individual commands by appending them with '--help', "
         "for example, 'paasta status --help' or see the man page with 'man paasta status'."
         ),
        epilog=
        ("The 'paasta' command line tool is designed to be used by humans, and therefore has "
         "command line completion for almost all options and uses pretty formatting when "
         "possible."),
    )

    # http://stackoverflow.com/a/8521644/812183
    parser.add_argument(
        '-V',
        '--version',
        action='version',
        version='paasta-tools {0}'.format(
            pkg_resources.get_distribution('paasta-tools').version))

    subparsers = parser.add_subparsers(help="[-h, --help] for subcommand help")

    for command in sorted(paasta_commands_dir(cmds)):
        add_subparser(command, subparsers)

    return parser