Skip to content

Commit

Permalink
add git status
Browse files Browse the repository at this point in the history
  • Loading branch information
nosarthur committed Jan 24, 2019
1 parent 4f0e074 commit 9cbb5c5
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 14 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ The supported sub-commands for git delegation are
* `gita pull <repo-name(s)>`: pull remote updates for the specified repo(s)
* `gita merge <repo-name(s)>`: merge remote updates for the specified repo(s)
* `gita push <repo-name(s)>`: push local updates of the specified repo(s) to remote
* `gita status <repo-name(s)>`: show repo(s) status

The repo paths are saved in `~/.gita_path`

Expand Down
32 changes: 19 additions & 13 deletions gita/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 9cbb5c5

Please sign in to comment.