From 3fa510d6bd7628a37ecf889b40faebd726978f2b Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Thu, 20 Jan 2011 14:58:35 +0100 Subject: Comment typo fix --- src/fedpkg.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fedpkg.py b/src/fedpkg.py index dbae1a8..e10177f 100755 --- a/src/fedpkg.py +++ b/src/fedpkg.py @@ -840,7 +840,7 @@ def verrel(args): sys.exit(1) print('%s-%s-%s' % (mymodule.module, mymodule.ver, mymodule.rel)) -# THe main code goes here +# The main code goes here if __name__ == '__main__': # Create the parser object parser = argparse.ArgumentParser(description = 'Fedora Packaging utility', -- cgit From 7ee64a029b22cb4a4cdafd5a827b7e06be519022 Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Fri, 21 Jan 2011 10:29:04 +0100 Subject: Move argparse setup into parse_cmdline function Move the argparse setup and the actual argument parsing into a separate parse_cmdline function. This makes the actual main program more clear, and allows reusing of the argparse setup for man page generation later. --- src/fedpkg.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/fedpkg.py b/src/fedpkg.py index e10177f..4bd565f 100755 --- a/src/fedpkg.py +++ b/src/fedpkg.py @@ -840,8 +840,10 @@ def verrel(args): sys.exit(1) print('%s-%s-%s' % (mymodule.module, mymodule.ver, mymodule.rel)) -# The main code goes here -if __name__ == '__main__': + +def parse_cmdline(generate_manpage = False): + """Parse the command line""" + # Create the parser object parser = argparse.ArgumentParser(description = 'Fedora Packaging utility', prog = 'fedpkg', @@ -1219,7 +1221,12 @@ packages will be built sequentially. parser_verrel.set_defaults(command = verrel) # Parse the args - args = parser.parse_args() + return parser.parse_args() + + +# The main code goes here +if __name__ == '__main__': + args = parse_cmdline() # setup the logger -- This logger will take things of INFO or DEBUG and # log it to stdout. Anything above that (WARN, ERROR, CRITICAL) will go -- cgit