Adds a sub-command parser to `subparsers` to generate and save
    a catalogue file.
517745
def generate_catalogue_subparser(subparsers):
    """"""
    parser = subparsers.add_parser(
        'catalogue', description=constants.CATALOGUE_DESCRIPTION,
        epilog=constants.CATALOGUE_EPILOG,
        formatter_class=ParagraphFormatter, help=constants.CATALOGUE_HELP)
    utils.add_common_arguments(parser)
    parser.set_defaults(func=generate_catalogue)
    parser.add_argument('corpus', help=constants.DB_CORPUS_HELP,
                        metavar='CORPUS')
    utils.add_query_arguments(parser)
    parser.add_argument('-l', '--label', default='',
                        help=constants.CATALOGUE_LABEL_HELP)
264345
def make_parser():
    """"""
    p = optparse.OptionParser()
    p.add_option('--prefix', metavar='DIR', help='install SDK in DIR')
    p.add_option('--bindir', metavar='DIR', help='install tools in DIR')
    p.add_option('--force', action='store_true', default=False,
        help='over-write existing installation')
    p.add_option('--no-bindir', action='store_true', default=False,
        help='do not install tools on DIR')

    return p
1214404
def generate_prepare_subparser(subparsers):
    """"""
    parser = subparsers.add_parser(
        'prepare', description=constants.PREPARE_DESCRIPTION,
        epilog=constants.PREPARE_EPILOG, formatter_class=ParagraphFormatter,
        help=constants.PREPARE_HELP)
    parser.set_defaults(func=prepare_xml)
    utils.add_common_arguments(parser)
    parser.add_argument('-s', '--source', dest='source',
                        choices=constants.TEI_SOURCE_CHOICES,
                        default=constants.TEI_SOURCE_CBETA_GITHUB,
                        help=constants.PREPARE_SOURCE_HELP,
                        metavar='SOURCE')
    parser.add_argument('input', help=constants.PREPARE_INPUT_HELP,
                        metavar='INPUT')
    parser.add_argument('output', help=constants.PREPARE_OUTPUT_HELP,
                        metavar='OUTPUT')
1142524
def add_shell_action(sub_parser: ArgumentParser) -> ArgumentParser:
    """"""

    sub_parser.add_argument(
        '-p', '--project',
        dest='project_directory',
        type=str,
        default=None
    )

    sub_parser.add_argument(
        '-l', '--log',
        dest='logging_path',
        type=str,
        default=None
    )

    sub_parser.add_argument(
        '-o', '--output',
        dest='output_directory',
        type=str,
        default=None
    )

    sub_parser.add_argument(
        '-s', '--shared',
        dest='shared_data_path',
        type=str,
        default=None
    )

    return sub_parser
606236
def add_action_to(cls, parser, action, subactions, level):
        
        p = parser.add_parser(action.name,
                              description=action.description,
                              argument_default=argparse.SUPPRESS)
        for arg in action.args:
            arg.add_argument_to(p)

        if subactions:
            subparsers = cls._add_subparsers_required(p,
                dest=settings.SUBASSISTANT_N_STRING.format(level),
                title=cls.subactions_str,
                description=cls.subactions_desc)
            for subact, subsubacts in sorted(subactions.items(), key=lambda x: x[0].name):
                cls.add_action_to(subparsers, subact, subsubacts, level + 1)
960704
def setup_parser():
    
    parser = optparse.OptionParser(
        usage="""\
usage: %prog [options] -o <output_path> <module_path> [exclude_path, ...]

Look recursively in <module_path> for Python modules and packages and create
one reST file with automodule directives per package in the <output_path>.

The <exclude_path>s can be files and/or directories that will be excluded
from generation.

Note: By default this script will not overwrite already created files.""")

    parser.add_option('-o', '--output-dir', action='store', dest='destdir',
                      help='Directory to place all output', default='')
    parser.add_option('-d', '--maxdepth', action='store', dest='maxdepth',
                      help='Maximum depth of submodules to show in the TOC '
                      '(default: 4)', type='int', default=4)
    parser.add_option('-f', '--force', action='store_true', dest='force',
                      help='Overwrite existing files')
    parser.add_option('-l', '--follow-links', action='store_true',
                      dest='followlinks', default=False,
                      help='Follow symbolic links. Powerful when combined '
                      'with collective.recipe.omelette.')
    parser.add_option('-n', '--dry-run', action='store_true', dest='dryrun',
                      help='Run the script without creating files')
    parser.add_option('-e', '--separate', action='store_true',
                      dest='separatemodules',
                      help='Put documentation for each module on its own page')
    parser.add_option('-P', '--private', action='store_true',
                      dest='includeprivate',
                      help='Include "_private" modules')
    parser.add_option('-T', '--no-toc', action='store_true', dest='notoc',
                      help='Don\'t create a table of contents file')
    parser.add_option('-E', '--no-headings', action='store_true',
                      dest='noheadings',
                      help='Don\'t create headings for the module/package '
                           'packages (e.g. when the docstrings already contain '
                           'them)')
    parser.add_option('-s', '--suffix', action='store', dest='suffix',
                      help='file suffix (default: rst)', default='rst')
    parser.add_option('-F', '--full', action='store_true', dest='full',
                      help='Generate a full project with sphinx-quickstart')
    parser.add_option('-H', '--doc-project', action='store', dest='header',
                      help='Project name (default: root module name)')
    parser.add_option('-A', '--doc-author', action='store', dest='author',
                      type='str',
                      help='Project author(s), used when --full is given')
    parser.add_option('-V', '--doc-version', action='store', dest='version',
                      help='Project version, used when --full is given')
    parser.add_option('-R', '--doc-release', action='store', dest='release',
                      help='Project release, used when --full is given, '
                      'defaults to --doc-version')
    return parser
641169
def parser(subparsers):
    ""

    # create the parser for the version subcommand.
    parser_version = subparsers.add_parser(
        'version',
        help="Output the version of %(prog)s to the console.")
    parser_version.set_defaults(func=command_version)

    return parser_version
1260628
def generate_catalogue(args, parser):
    """"""
    catalogue = tacl.Catalogue()
    catalogue.generate(args.corpus, args.label)
    catalogue.save(args.catalogue)
415162
def create_parser():
    """"""
    parser = ArgumentParser(
        formatter_class=RawDescriptionHelpFormatter,
        description=DESCRIPTION,
        epilog=EPILOG,
        add_help=False)

    directory = parser.add_argument_group("Directory")
    directory.add_argument(
        dest='directory',
        action="store",
        default=None,
        nargs="?",
        help="The directory from which to start the search "
        "(defaults to current working directory)")

    globs = parser.add_argument_group("Globs")
    globs.add_argument(
        '-i',
        '--include',
        action="store",
        nargs="*",
        help="One or more Ant-like globs in include in the search."
        "If not specified, then all files are implied")
    globs.add_argument(
        '-e',
        '--exclude',
        action="store",
        nargs="*",
        help="One or more Ant-like globs in include in the search")
    globs.add_argument(
        '--no-default-excludes',
        dest="default_excludes",
        action="store_false",
        default=True,
        help="Do not include the default excludes")
    globs.add_argument(
        '--no-symlinks',
        action="store_true",
        default=False,
        help="Do not include symlinks")
    globs.add_argument(
        '--insensitive',
        action="store_true",
        default=False,
        help="Turn off case-sensitive, default sensitive on POSIX, always insensitive on NT.")

    output = parser.add_argument_group("Output")
    output.add_argument(
        '-r',
        '--relative',
        action="store_true",
        default=False,
        help="Print file paths relative to directory.")

    info = parser.add_argument_group("Information")
    info.add_argument(
        '-h',
        '--help',
        action='store_true',
        default=False,
        help="Prints this help and exits")
    info.add_argument(
        '--usage',
        action='store_true',
        default=False,
        help="Prints additional help on globs and exits")
    info.add_argument(
        '--version',
        action='store_true',
        default=False,
        help="Prints the version of formic and exits")
    info.add_argument('--license', action="store_true", help=SUPPRESS)
    return parser
1175152
def create_arg_parser(parent):
    

    arg1 = parent.add_subparsers(dest='command')

    arg2 = arg1.add_parser('create')
    arg2.add_argument('-P', '--progress',
                      action='store_true',
                      help='show progress bar')
    arg2.add_argument('-s', '--settings',
                      type=FileType('r'), default=None,
                      help='settings json file')
    arg2.add_argument('-o', '--output',
                      default=None,
                      help='output file (default: stdout)')
    arg2.add_argument('input', nargs='*',
                      help='input file')

    arg2 = arg1.add_parser('update')
    arg2.add_argument('-P', '--progress',
                      action='store_true',
                      help='show progress bar')
    arg2.add_argument('-s', '--settings',
                      type=FileType('r'), default=None,
                      help='settings json file')
    arg2.add_argument('-o', '--output',
                      default=None,
                      help='output file (default: rewrite state file)')
    arg2.add_argument('state',
                      help='state file')
    arg2.add_argument('input', nargs='*',
                      help='input file')

    arg2 = arg1.add_parser('settings')
    arg2.add_argument('state',
                      help='state file')

    arg2 = arg1.add_parser('generate')
    arg2.add_argument('-P', '--progress',
                      action='store_true',
                      help='show progress bar')
    arg2.add_argument('-s', '--settings',
                      type=FileType('r'), default=None,
                      help='settings json file')
    arg2.add_argument('-ss', '--state-size',
                      type=int, nargs='+', default=None,
                      help='generator state sizes')
    arg2.add_argument('-S', '--size', metavar=('WIDTH', 'HEIGHT'),
                      type=int, nargs=2, default=None,
                      help='image size (default: <scanner.resize>)')
    arg2.add_argument('-l', '--level',
                      type=int, default=None,
                      help='image levels (default: <scanner.levels>)')
    arg2.add_argument('-c', '--count',
                      type=int, default=1,
                      help='generated image count (default: %(default)s)')
    arg2.add_argument('state',
                      help='state file')
    arg2.add_argument('output',
                      help='output file name format string')

    arg2 = arg1.add_parser('filter')
    arg2.add_argument('-P', '--progress',
                      action='store_true',
                      help='show progress bar')
    arg2.add_argument('-t', '--type',
                      choices=('json', 'sqlite'), default='json',
                      help='generator type (default: %(default)s)')
    arg2.add_argument('-s', '--settings',
                      type=FileType('r'), default=None,
                      help='settings json file')
    arg2.add_argument('-S', '--state',
                      default=None,
                      help='state file')
    arg2.add_argument('-ss', '--state-size',
                      type=int, nargs='+', default=None,
                      help='generator state sizes')
    arg2.add_argument('-l', '--level',
                      type=int, default=1,
                      help='filter start level (default: %(default)s)')
    arg2.add_argument('-c', '--count',
                      type=int, default=1,
                      help='generated image count (default: %(default)s)')
    arg2.add_argument('input',
                      help='input image')
    arg2.add_argument('output',
                      help='output file name format string')
139584
def add_batch_parser(subparsers, parent_parser):
    
    parser = subparsers.add_parser(
        'batch',
        help='Displays information about batches and submit new batches',
        description='Provides subcommands to display Batch information and '
        'submit Batches to the validator via the REST API.')

    grand_parsers = parser.add_subparsers(title='subcommands',
                                          dest='subcommand')
    grand_parsers.required = True
    add_batch_list_parser(grand_parsers, parent_parser)
    add_batch_show_parser(grand_parsers, parent_parser)
    add_batch_status_parser(grand_parsers, parent_parser)
    add_batch_submit_parser(grand_parsers, parent_parser)
168182
def add_status_parser(subparsers, parent_parser):
    
    parser = subparsers.add_parser(
        'status',
        help='Displays information about validator status',
        description="Provides a subcommand to show a validator\'s status")

    grand_parsers = parser.add_subparsers(title='subcommands',
                                          dest='subcommand')
    grand_parsers.required = True
    add_status_show_parser(grand_parsers, parent_parser)
457430
def create_parser(self, subparsers):
        
        self.parser = subparsers.add_parser(self.name, help=self.help, parents=self.parents)
        self.add_arguments()
        self.parser.set_defaults(func=self.handle)
        return self.parser
780369
def build(sub_parser, cmds):
    

    res = {}
    for cmd in cmds:
        res[cmd.name] = cmd(sub_parser)
    # end for cmd in cmds

    return res
1115822
def fix_subparsers(subparsers):
    
    from dvc.utils.compat import is_py3

    if is_py3:  # pragma: no cover
        subparsers.required = True
        subparsers.dest = "cmd"
812609
def create_parser():
    
    parser = argparse.ArgumentParser(prog=pylink.__title__,
                                     description=pylink.__description__,
                                     epilog=pylink.__copyright__)
    parser.add_argument('--version', action='version',
                        version='%(prog)s ' + pylink.__version__)
    parser.add_argument('-v', '--verbose', action='count', default=0,
                        help='increase output verbosity')

    kwargs = {}
    kwargs['title'] = 'command'
    kwargs['description'] = 'specify subcommand to run'
    kwargs['help'] = 'subcommands'
    subparsers = parser.add_subparsers(**kwargs)

    for command in commands():
        kwargs = {}
        kwargs['name'] = command.name
        kwargs['description'] = command.description
        kwargs['help'] = command.help
        subparser = subparsers.add_parser(**kwargs)
        subparser.set_defaults(command=command.run)
        command.add_arguments(subparser)

    return parser
158410
def prepare_parser(program):
    """"""
    parser = ArgumentParser(
        description=PROG_DESCRIPTION, prog=program,
        formatter_class=HelpFormatter,
        add_help=False)
    parser.add_argument(
        "-h", "--help", action=MinimalHelpAction, help=argparse.SUPPRESS)

    # Register sub-commands.
    submodules = (
        "nodes", "machines", "devices", "controllers",
        "fabrics", "vlans", "subnets", "spaces",
        "files", "tags", "users",
        "profiles", "shell",
    )
    cmd_help.register(parser)
    for submodule in submodules:
        module = import_module("." + submodule, __name__)
        module.register(parser)

    # Register global options.
    parser.add_argument(
        '--debug', action='store_true', default=False,
        help=argparse.SUPPRESS)

    return parser