def make_argument_parser()

in lib/ramble/spack/main.py [0:0]


def make_argument_parser(**kwargs):
    """Create an basic argument parser without any subcommands added."""
    parser = SpackArgumentParser(
        formatter_class=SpackHelpFormatter, add_help=False,
        description=(
            "A flexible package manager that supports multiple versions,\n"
            "configurations, platforms, and compilers."),
        **kwargs)

    # stat names in groups of 7, for nice wrapping.
    stat_lines = list(zip(*(iter(stat_names),) * 7))

    parser.add_argument(
        '-h', '--help',
        dest='help', action='store_const', const='short', default=None,
        help="show this help message and exit")
    parser.add_argument(
        '-H', '--all-help',
        dest='help', action='store_const', const='long', default=None,
        help="show help for all commands (same as spack help --all)")
    parser.add_argument(
        '--color', action='store',
        default=os.environ.get('SPACK_COLOR', 'auto'),
        choices=('always', 'never', 'auto'),
        help="when to colorize output (default: auto)")
    parser.add_argument(
        '-c', '--config', default=None, action="append", dest="config_vars",
        help="add one or more custom, one off config settings.")
    parser.add_argument(
        '-C', '--config-scope', dest='config_scopes', action='append',
        metavar='DIR', help="add a custom configuration scope")
    parser.add_argument(
        '-d', '--debug', action='count', default=0,
        help="write out debug messages "
             "(more d's for more verbosity: -d, -dd, -ddd, etc.)")
    parser.add_argument(
        '--timestamp', action='store_true',
        help="Add a timestamp to tty output")
    parser.add_argument(
        '--pdb', action='store_true',
        help="run spack under the pdb debugger")

    env_group = parser.add_mutually_exclusive_group()
    env_group.add_argument(
        '-e', '--env', dest='env', metavar='ENV', action='store',
        help="run with a specific environment (see spack env)")
    env_group.add_argument(
        '-D', '--env-dir', dest='env_dir', metavar='DIR', action='store',
        help="run with an environment directory (ignore named environments)")
    env_group.add_argument(
        '-E', '--no-env', dest='no_env', action='store_true',
        help="run without any environments activated (see spack env)")
    parser.add_argument(
        '--use-env-repo', action='store_true',
        help="when running in an environment, use its package repository")

    parser.add_argument(
        '-k', '--insecure', action='store_true',
        help="do not check ssl certificates when downloading")
    parser.add_argument(
        '-l', '--enable-locks', action='store_true', dest='locks',
        default=None, help="use filesystem locking (default)")
    parser.add_argument(
        '-L', '--disable-locks', action='store_false', dest='locks',
        help="do not use filesystem locking (unsafe)")
    parser.add_argument(
        '-m', '--mock', action='store_true',
        help="use mock packages instead of real ones")
    parser.add_argument(
        '-b', '--bootstrap', action='store_true',
        help="use bootstrap configuration (bootstrap store, config, externals)")
    parser.add_argument(
        '-p', '--profile', action='store_true', dest='spack_profile',
        help="profile execution using cProfile")
    parser.add_argument(
        '--sorted-profile', default=None, metavar="STAT",
        help="profile and sort by one or more of:\n[%s]" %
        ',\n '.join([', '.join(line) for line in stat_lines]))
    parser.add_argument(
        '--lines', default=20, action='store',
        help="lines of profile output or 'all' (default: 20)")
    parser.add_argument(
        '-v', '--verbose', action='store_true',
        help="print additional output during builds")
    parser.add_argument(
        '--stacktrace', action='store_true',
        default='SPACK_STACKTRACE' in os.environ,
        help="add stacktraces to all printed statements")
    parser.add_argument(
        '-V', '--version', action='store_true',
        help='show version number and exit')
    parser.add_argument(
        '--print-shell-vars', action='store',
        help="print info needed by setup-env.[c]sh")

    return parser