conda_argparse#

Conda command line interface parsers.

Classes#

ArgumentParser

Object for parsing command line strings into Python objects.

_GreedySubParsersAction

A custom subparser action to conditionally act as a greedy consumer.

Functions#

generate_pre_parser(→ ArgumentParser)

generate_parser(→ ArgumentParser)

do_call(args, parser)

Serves as the primary entry point for commands referred to in this file and for

find_builtin_commands(parser)

_exec(executable_args, env_vars)

_exec_win(executable_args, env_vars)

_exec_unix(executable_args, env_vars)

configure_parser_plugins(→ None)

For each of the provided plugin-based subcommands, we'll create

Attributes#

escaped_user_rc_path#
escaped_sys_rc_path#
BUILTIN_COMMANDS#
generate_pre_parser(**kwargs) ArgumentParser#
generate_parser(**kwargs) ArgumentParser#
do_call(args: argparse.Namespace, parser: ArgumentParser)#

Serves as the primary entry point for commands referred to in this file and for all registered plugin subcommands.

find_builtin_commands(parser)#
class ArgumentParser(*args, add_help=True, **kwargs)#

Bases: argparse.ArgumentParser

Object for parsing command line strings into Python objects.

Keyword Arguments:
  • (default (- usage -- A usage message) -- os.path.basename(sys.argv[0]))

  • (default -- auto-generated from arguments)

  • does (- description -- A description of what the program)

  • descriptions (- epilog -- Text following the argument)

  • one (- parents -- Parsers whose arguments should be copied into this)

  • messages (- formatter_class -- HelpFormatter class for printing help)

  • arguments (- argument_default -- The default value for all)

  • containing (- fromfile_prefix_chars -- Characters that prefix files) -- additional arguments

  • arguments

  • conflicts (- conflict_handler -- String indicating how to handle)

  • option (- add_help -- Add a -h/-help)

  • unambiguously (- allow_abbrev -- Allow long options to be abbreviated)

  • with (- exit_on_error -- Determines whether or not ArgumentParser exits) -- error info when an error occurs

_check_value(action, value)#
parse_args(*args, override_args=None, **kwargs)#
class _GreedySubParsersAction(option_strings, prog, parser_class, dest=SUPPRESS, required=False, help=None, metavar=None)#

Bases: argparse._SubParsersAction

A custom subparser action to conditionally act as a greedy consumer.

This is a workaround since argparse.REMAINDER does not work as expected, see python/cpython#61252.

__call__(parser, namespace, values, option_string=None)#
_get_subactions()#

Sort actions for subcommands to appear alphabetically in help blurb.

_exec(executable_args, env_vars)#
_exec_win(executable_args, env_vars)#
_exec_unix(executable_args, env_vars)#
configure_parser_plugins(sub_parsers) None#

For each of the provided plugin-based subcommands, we'll create a new subparser for an improved help printout and calling the configure_parser() with the newly created subcommand specific argument parser.