From 360134d7f77d4afb9240b0f17ed928f9f1756bc1 Mon Sep 17 00:00:00 2001 From: Julio Biason Date: Fri, 14 Oct 2022 14:02:45 -0300 Subject: [PATCH] Making subparsers in Python --- pyparsers.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 pyparsers.py diff --git a/pyparsers.py b/pyparsers.py new file mode 100644 index 0000000..77ba10c --- /dev/null +++ b/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()