commit:     0c931533d9ad82c4c724e7de25db07851cea2f66
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Fri Oct  9 03:31:03 2015 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Fri Oct  9 03:31:03 2015 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=0c931533

main: group related command line flags

This makes the --help output more manageable so people can quickly
scan and skip options that they don't care about.

 catalyst/main.py | 48 ++++++++++++++++++++++++++++--------------------
 1 file changed, 28 insertions(+), 20 deletions(-)

diff --git a/catalyst/main.py b/catalyst/main.py
index 03c13c0..e6b6447 100644
--- a/catalyst/main.py
+++ b/catalyst/main.py
@@ -168,41 +168,49 @@ Using the specfile option (-f, --file) to build a stage 
target:
 $ catalyst -f stage1-specfile.spec"""
 
        parser = argparse.ArgumentParser(epilog=epilog, 
formatter_class=argparse.RawDescriptionHelpFormatter)
-       parser.add_argument('-d', '--debug',
+
+       parser.add_argument('-V', '--version',
+               action='version', version=get_version(),
+               help='display version information')
+
+       group = parser.add_argument_group('Program output options')
+       group.add_argument('-d', '--debug',
                default=False, action='store_true',
                help='enable debugging')
-       parser.add_argument('-v', '--verbose',
+       group.add_argument('-v', '--verbose',
                default=False, action='store_true',
                help='verbose output')
-       parser.add_argument('-c', '--config',
-               type=FilePath(),
-               help='use specified configuration file')
-       parser.add_argument('-f', '--file',
-               type=FilePath(),
-               help='read specfile')
-       parser.add_argument('-F', '--fetchonly',
-               default=False, action='store_true',
-               help='fetch files only')
-       parser.add_argument('-a', '--clear-autoresume',
+
+       group = parser.add_argument_group('Temporary file management')
+       group.add_argument('-a', '--clear-autoresume',
                default=False, action='store_true',
                help='clear autoresume flags')
-       parser.add_argument('-p', '--purge',
+       group.add_argument('-p', '--purge',
                default=False, action='store_true',
                help='clear tmp dirs, package cache, autoresume flags')
-       parser.add_argument('-P', '--purgeonly',
+       group.add_argument('-P', '--purgeonly',
                default=False, action='store_true',
                help='clear tmp dirs, package cache, autoresume flags and exit')
-       parser.add_argument('-T', '--purgetmponly',
+       group.add_argument('-T', '--purgetmponly',
                default=False, action='store_true',
                help='clear tmp dirs and autoresume flags and exit')
-       parser.add_argument('-s', '--snapshot',
+
+       group = parser.add_argument_group('Target/config file management')
+       group.add_argument('-F', '--fetchonly',
+               default=False, action='store_true',
+               help='fetch files only')
+       group.add_argument('-c', '--config',
+               type=FilePath(),
+               help='use specified configuration file')
+       group.add_argument('-f', '--file',
+               type=FilePath(),
+               help='read specfile')
+       group.add_argument('-s', '--snapshot',
                help='generate a release snapshot')
-       parser.add_argument('-V', '--version',
-               action='version', version=get_version(),
-               help='display version information')
-       parser.add_argument('-C', '--cli',
+       group.add_argument('-C', '--cli',
                default=[], nargs=argparse.REMAINDER,
                help='catalyst commandline (MUST BE LAST OPTION)')
+
        return parser
 
 

Reply via email to