From 9cbb5c5ba21aaf593837ce8d6c2caba257b15792 Mon Sep 17 00:00:00 2001 From: Dong Zhou Date: Wed, 23 Jan 2019 22:24:46 -0500 Subject: [PATCH] add git status --- README.md | 1 + gita/__main__.py | 32 +++++++++++++++++++------------- setup.py | 2 +- 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 3379d6d..fab42ad 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,7 @@ The supported sub-commands for git delegation are * `gita pull `: pull remote updates for the specified repo(s) * `gita merge `: merge remote updates for the specified repo(s) * `gita push `: push local updates of the specified repo(s) to remote +* `gita status `: show repo(s) status The repo paths are saved in `~/.gita_path` diff --git a/gita/__main__.py b/gita/__main__.py index 038135b..d131739 100644 --- a/gita/__main__.py +++ b/gita/__main__.py @@ -47,41 +47,47 @@ def main(argv=None): p.add_argument('--version', action='version', version=f'%(prog)s {version}') # git related sub-commands - p_ls = subparsers.add_parser('ls', help='display all repos') - 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_add = subparsers.add_parser('add', help='add repo(s)') p_add.add_argument('repo', nargs='+', help="add repo(s)") p_add.set_defaults(func=f_add) - p_rm = subparsers.add_parser('rm', help='remove repo') - p_rm.add_argument('repo', choices=utils.get_repos(), - help="remove the chosen repo") - p_rm.set_defaults(func=f_rm) - p_fetch = subparsers.add_parser('fetch', help='fetch remote updates for all repos or the chosen repo(s)') p_fetch.add_argument('repo', nargs='*', choices=utils.get_choices(), help="fetch remote update for the chosen repo(s)") p_fetch.set_defaults(func=f_git_cmd, cmd='git fetch') - p_pull = subparsers.add_parser('pull', help='pull remote updates') - p_pull.add_argument('repo', nargs='+', choices=utils.get_repos(), - help="pull remote update for the chosen repo(s)") - p_pull.set_defaults(func=f_git_cmd, cmd='git pull') + p_ls = subparsers.add_parser('ls', help='display all repos') + 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_merge = subparsers.add_parser('merge', help='merge remote updates') p_merge.add_argument('repo', nargs='+', choices=utils.get_repos(), help="merge remote update for the chosen repo(s)") p_merge.set_defaults(func=f_git_cmd, cmd='git merge @{u}') + p_pull = subparsers.add_parser('pull', help='pull remote updates') + p_pull.add_argument('repo', nargs='+', choices=utils.get_repos(), + help="pull remote update for the chosen repo(s)") + p_pull.set_defaults(func=f_git_cmd, cmd='git pull') + p_push = subparsers.add_parser('push', help='push the local updates') p_push.add_argument('repo', nargs='+', choices=utils.get_repos(), help="push the local update to remote for the chosen repo(s)") p_push.set_defaults(func=f_git_cmd, cmd='git push') + p_rm = subparsers.add_parser('rm', help='remove repo') + p_rm.add_argument('repo', choices=utils.get_repos(), + help="remove the chosen repo") + p_rm.set_defaults(func=f_rm) + + p_status = subparsers.add_parser('status', help='show repo status') + p_status.add_argument('repo', nargs='+', choices=utils.get_repos(), + help="show status of the repo") + p_status.set_defaults(func=f_git_cmd, cmd='git status') + args = p.parse_args(argv) if 'func' in args: diff --git a/setup.py b/setup.py index fa0fd4d..6d79760 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ setup( name='gita', packages=['gita',], - version='0.4.10', + version='0.5.0', description='Manage multiple git repos', long_description=long_description, long_description_content_type='text/markdown',