From 1a0488d1235bb642ccdf631080707f5c63def129 Mon Sep 17 00:00:00 2001 From: pac23 Date: Jul 11 2019 11:38:38 +0000 Subject: add more help in main.py --- diff --git a/main.py b/main.py index 3b2f2d0..e3aa9f5 100644 --- a/main.py +++ b/main.py @@ -22,9 +22,19 @@ class Change_Tool(object): def __init__(self): parser = argparse.ArgumentParser( description='Cli for Change Tool', - usage='''change-tool []''' - ) - parser.add_argument('command', help='Subcommand to run') + usage='''fedora-change-wrangler [] + +The commands are: + auth Authenticates with Bugzilla,Taiga and Pagure + convert Converts the Taiga issues to user stories + list Lists the Pending issues/userstory as per the optinal argument + announce Announces to the mailing list of the approved change + fesco Creates issues on the fesco repo with details from the approved change proposal + accept Accepts the Change Proposal by Converting issue to user story and creates a tracking bug in Bugzilla + sync Syncs the tracking bug status with Taiga status + --help Lists out the subcommand in each subcommand of the cli +''') + parser.add_argument('command', help='Subcommand --flags') # parse_args defaults to [1:] for args, but you need to # exclude the rest of the args too, or validation will fail args = parser.parse_args(sys.argv[1:2]) @@ -76,11 +86,13 @@ class Change_Tool(object): taiga_auth.reset(args) else: print("Wrong command") + print(parser.print_help()) elif args.command == 'pagure': if args.reset: pagure_auth.reset(args) else: print("Wrong command") + print(parser.print_help()) elif args.command == 'bugzilla': if args.token: bugzilla_auth.refresh_token(args) @@ -88,13 +100,16 @@ class Change_Tool(object): bugzilla_auth.reset(args) else: print("Wrong command,please check documentation for the proper command") + print(parser.print_help()) elif args.command == 'email': if args.reset: mailauth.reset(args) else: print("Wrong Command check documentation") + print(parser.print_help()) else: print("Please Check the Documentation for the proper command or press --h for help") + print(parser.print_help()) # print("Running the auth instance.....") # authenticate() @@ -125,7 +140,13 @@ class Change_Tool(object): configpath = args.config print(configpath) # Debug only print(args) # debug only - convert.convert(args.taiga, args.config) + if args.command == 'taiga': + convert.convert(args.taiga, args.config) + elif args.command == 'help': + print(parser.print_help()) + else: + print("Wrong Command") + print(parser.print_help()) def list(self): parser = argparse.ArgumentParser( @@ -215,13 +236,14 @@ class Change_Tool(object): parser.add_argument('--issue', nargs='+', type=int, - help='Announces to Mailing list') + #description='Issue No', + help='Accepts the taiga change propsal issue') parser.add_argument('--config', #dest='configpath', #action='store', #type=string, default='config.ini', - help='Sets config path') + help='Sets User Defined Config path') args = parser.parse_args(sys.argv[2:]) #configpath = args.config #print(configpath) @@ -231,13 +253,15 @@ class Change_Tool(object): #accept.accept(args.accept, args.config) accept.accept(args) - def sync(self): + def update(self): parser = argparse.ArgumentParser( description='Syncing Between Bugzilla and Taiga') - parser.add_argument('--sync_status', + + parser.add_argument('--update', nargs='+', type=int, help='Syncing between bugzilla and taiga') + parser.add_argument('--config', #dest='configpath', #action='store', @@ -245,7 +269,7 @@ class Change_Tool(object): default='config.ini', help='Sets config path') args = parser.parse_args(sys.argv[2:]) - sync.sync(args) + update.sync(args) """ def config(self):