Пример #1
0
def configure_parser_repoquery(sub_parsers):
    help = "Query repositories using mamba. "
    descr = (help)

    example = ("""
Examples:

    mamba repoquery search xtensor>=0.18
    mamba repoquery depends xtensor
    mamba repoquery whoneeds xtl

    """)

    import argparse
    from argparse import SUPPRESS

    p = sub_parsers.add_parser('repoquery',
                               description=descr,
                               help=help,
                               epilog=example)
    subsub_parser = p.add_subparsers(dest='subcmd')
    package_cmds = argparse.ArgumentParser(add_help=False)
    package_cmds.add_argument('package_query', help='the target package')
    package_cmds.add_argument("-i",
                              "--installed",
                              action="store_true",
                              help=SUPPRESS)

    package_cmds.add_argument(
        "-a",
        "--all-channels",
        action="store_true",
        help="Look at all channels (for depends / whoneeds)")

    view_cmds = argparse.ArgumentParser(add_help=False)
    view_cmds.add_argument("-t", "--tree", action="store_true")

    subsub_parser.add_parser(
        'whoneeds',
        help='shows packages that depends on this package',
        parents=[package_cmds, view_cmds])

    subsub_parser.add_parser(
        'depends',
        help='shows packages that depends on this package',
        parents=[package_cmds, view_cmds])

    subsub_parser.add_parser(
        'search',
        help='shows packages that depends on this package',
        parents=[package_cmds])

    from conda.cli import conda_argparse
    conda_argparse.add_parser_channels(p)
    conda_argparse.add_parser_networking(p)
    conda_argparse.add_parser_known(p)
    conda_argparse.add_parser_json(p)

    p.set_defaults(func='.main_repoquery.execute')
    return p
Пример #2
0
def configure_parser_repoquery(sub_parsers):
    help = "Query repositories using mamba. "
    descr = (help)

    example = ("""
Examples:

    conda repoquery xtensor>=0.18

    """)

    from argparse import SUPPRESS

    p = sub_parsers.add_parser(
        'repoquery',
        description=descr,
        help=help,
        epilog=example,
    )

    p.add_argument(
        'query',
        action="store",
        nargs='?',
        help="Package query.",
    )

    p.add_argument(
        "--whatrequires",
        action="store_true",
        help=SUPPRESS,
    )

    p.add_argument(
        "--installed",
        action="store_true",
        help=SUPPRESS,
    )

    p.add_argument(
        "--tree",
        action="store_true",
        help=SUPPRESS,
    )

    from conda.cli import conda_argparse
    conda_argparse.add_parser_channels(p)
    conda_argparse.add_parser_networking(p)
    conda_argparse.add_parser_known(p)

    p.set_defaults(func='.main_repoquery.execute')
    return p
Пример #3
0
def configure_parser_repoquery(sub_parsers):
    help_cli = "Query repositories using mamba. "
    descr = help_cli

    example = """
Examples:

    mamba repoquery search xtensor>=0.18
    mamba repoquery depends xtensor
    mamba repoquery whoneeds xtl

    """

    import argparse
    from argparse import SUPPRESS

    p = sub_parsers.add_parser("repoquery",
                               description=descr,
                               help=help_cli,
                               epilog=example)
    subsub_parser = p.add_subparsers(dest="subcmd")
    package_cmds = argparse.ArgumentParser(add_help=False)
    package_cmds.add_argument("package_query", help="the target package")
    package_cmds.add_argument("-i",
                              "--installed",
                              action="store_true",
                              default=True,
                              help=SUPPRESS)

    package_cmds.add_argument("-p", "--platform")
    package_cmds.add_argument("--no-installed", action="store_true")
    package_cmds.add_argument("--pretty", action="store_true")

    package_cmds.add_argument(
        "-a",
        "--all-channels",
        action="store_true",
        help="Look at all channels (for depends / whoneeds)",
    )

    view_cmds = argparse.ArgumentParser(add_help=False)
    view_cmds.add_argument("-t", "--tree", action="store_true")

    c1 = subsub_parser.add_parser(
        "whoneeds",
        help="shows packages that depends on this package",
        parents=[package_cmds, view_cmds],
    )

    c2 = subsub_parser.add_parser(
        "depends",
        help="shows packages that depends on this package",
        parents=[package_cmds, view_cmds],
    )

    c3 = subsub_parser.add_parser(
        "search",
        help="shows packages that depends on this package",
        parents=[package_cmds],
    )

    from conda.cli import conda_argparse

    for cmd in (c1, c2, c3):
        conda_argparse.add_parser_channels(cmd)
        conda_argparse.add_parser_networking(cmd)
        conda_argparse.add_parser_known(cmd)
        conda_argparse.add_parser_json(cmd)

    p.set_defaults(func=".main_repoquery.execute")
    return p