Browse Source

Making subparsers in Python

master
Julio Biason 2 years ago
parent
commit
360134d7f7
  1. 19
      pyparsers.py

19
pyparsers.py

@ -0,0 +1,19 @@
import argparse
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.add_argument('collection')
sync = git_subs.add_parser(name='sync', help='Sync')
args = parser.parse_args()
if __name__ == '__main__':
main()
Loading…
Cancel
Save