示例#1
0
def _parse_args():
    parser = argparse.ArgumentParser('XiVO dev toolkit')
    parser.add_argument("-bc", "--buildclient", help="rebuild XiVO client from sources",
                        action="store_true")
    parser.add_argument("-bd", "--builddoc", help="rebuild XiVO doc from sources",
                        action="store_true")
    parser.add_argument("-c", "--coverage", help="check code coverage",
                        action="store_true")
    parser.add_argument("-d", "--dry", help="dry run - displays but do not execute commands (when applicable)",
                        action="store_true")
    parser.add_argument("-D", "--deletemerged", help="Delete branch already merged into masters",
                        action="store_true")
    parser.add_argument("-f", "--fetch", help="git fetch repositories",
                        action="store_true")
    parser.add_argument("-v", "--verbose", help="increase output verbosity",
                        action="store_true")
    parser.add_argument("-t", "--tags", help="update CTAGS",
                        action="store_true")
    parser.add_argument("-p", "--pull", help="git pull repositories",
                        action="store_true")
    parser.add_argument("-l", "--list", help="list all repositories and their current branch",
                        action="store_true")
    parser.add_argument("-ll", "--longlist", help="list all repositories with additionnal infos",
                        action="store_true")
    parser.add_argument("-s", "--sync", help='sync repos on given IP or hostname')
    parser.add_argument("-b", "--batch", help='batch execute git command on given repos')
    parser.add_argument("-g", "--grepbranches", help='find branches names for given query')
    parser.add_argument("-vl", "--vmlist", help='list virtualbox vms',
                        action="store_true")
    parser.add_argument("-v1", "--vmstart", help='start virtualbox vm with given name')
    parser.add_argument("-v0", "--vmstop", help=' stop virtualbox vm with given name')
    parser.add_argument("-vs", "--vmsnapshot", help=' snapshot virtualbox vm with given name',
                        nargs=2, metavar=('name', 'description'))
    parser.add_argument("-r", "--repos", help='list of repos on which to operate (default : all handled repos)',
                        nargs='*', type=_is_handled_repo, default=[name for name in REPOS.iterkeys()])

    return parser.parse_args()
示例#2
0
def _is_handled_repo(repo_name):
    if repo_name not in REPOS.iterkeys():
        msg = '%s is not a supported repository name' % repo_name
        raise argparse.ArgumentTypeError(msg)
    return repo_name