diff options
author | Hans Ulrich Niedermann <hun@n-dimensional.de> | 2011-01-21 10:29:04 +0100 |
---|---|---|
committer | Hans Ulrich Niedermann <hun@n-dimensional.de> | 2011-02-01 16:23:23 +0100 |
commit | ca06e5006e7549d9a39a1daba7929dfc88864f29 (patch) | |
tree | 3c6bf51ed1a9f865a0e88e0e7ca364ad8cae0976 /src/fedpkg.py | |
parent | f2e4fc2f59b9aab31843ef04f97fb4fbf750f616 (diff) | |
download | fedora-packager-ca06e5006e7549d9a39a1daba7929dfc88864f29.tar.gz fedora-packager-ca06e5006e7549d9a39a1daba7929dfc88864f29.tar.xz fedora-packager-ca06e5006e7549d9a39a1daba7929dfc88864f29.zip |
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.
Diffstat (limited to 'src/fedpkg.py')
-rwxr-xr-x | src/fedpkg.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/fedpkg.py b/src/fedpkg.py index fb5c708..1a59986 100755 --- a/src/fedpkg.py +++ b/src/fedpkg.py @@ -846,8 +846,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', @@ -1228,7 +1230,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 |