How to use the gita.utils.get_choices function in gita

To help you get started, we’ve selected a few gita examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nosarthur / gita / gita / __main__.py View on Github external
'\t gita super repo1 repo2 repo3 checkout new-feature')
    p_super.add_argument(
        'man',
        nargs=argparse.REMAINDER,
        help="execute arbitrary git command/alias for specified or all repos "
        "Example: gita super myrepo1 diff --name-only --staged "
        "Another: gita super checkout master ")
    p_super.set_defaults(func=f_super)

    # sub-commands that fit boilerplate
    cmds = utils.get_cmds_from_files()
    for name, data in cmds.items():
        help = data.get('help')
        cmd = data.get('cmd') or name
        if data.get('allow_all'):
            choices = utils.get_choices()
            nargs = '*'
            help += ' for all repos or'
        else:
            choices = utils.get_repos().keys() | utils.get_groups().keys()
            nargs = '+'
        help += ' for the chosen repo(s) or group(s)'
        sp = subparsers.add_parser(name, help=help)
        sp.add_argument('repo', nargs=nargs, choices=choices, help=help)
        sp.set_defaults(func=f_git_cmd, cmd=cmd.split())

    args = p.parse_args(argv)

    args.async_blacklist = {
        name
        for name, data in cmds.items() if data.get('disable_async')
    }
github nosarthur / gita / gita / __main__.py View on Github external
help="show repos in the chosen group")
    p_ll.set_defaults(func=f_ll)

    p_ls = subparsers.add_parser(
        'ls', help='display names of all repos, or path of a chosen repo')
    p_ls.add_argument('repo',
                      nargs='?',
                      choices=utils.get_repos(),
                      help="show path of the chosen repo")
    p_ls.set_defaults(func=f_ls)

    p_group = subparsers.add_parser(
        'group', help='group repos or display names of all groups if no repo is provided')
    p_group.add_argument('to_group',
                      nargs='*',
                      choices=utils.get_choices(),
                      help="repo(s) to be grouped")
    p_group.set_defaults(func=f_group)

    p_ungroup = subparsers.add_parser(
        'ungroup', help='remove group information for repos',
        description="Remove group information on repos")
    p_ungroup.add_argument('to_ungroup',
                      nargs='+',
                      choices=utils.get_repos(),
                      help="repo(s) to be ungrouped")
    p_ungroup.set_defaults(func=f_ungroup)

    # superman mode
    p_super = subparsers.add_parser(
        'super',
        help='superman mode: delegate any git command/alias in specified or '