You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
734 B
33 lines
734 B
import argparse |
|
|
|
def git_init(args): |
|
print('Init collection:', args.collection) |
|
|
|
def git_sync(args): |
|
print('Sync') |
|
|
|
def main(): |
|
parser = argparse.ArgumentParser(description='Main') |
|
subparsers = parser.add_subparsers() |
|
|
|
git = subparsers.add_parser(name='git', help='Git commands') |
|
git_subs = git.add_subparsers() |
|
|
|
init = git_subs.add_parser(name='init', help='Init') |
|
init.set_defaults(func=git_init) |
|
init.add_argument('collection') |
|
|
|
sync = git_subs.add_parser(name='sync', help='Sync') |
|
sync.set_defaults(func=git_sync) |
|
|
|
args = parser.parse_args() |
|
|
|
if not hasattr(args, 'func'): |
|
parser.print_usage() |
|
return |
|
|
|
args.func(args) |
|
|
|
|
|
if __name__ == '__main__': |
|
main()
|
|
|