Gentoo Archives: gentoo-catalyst

From: Mike Frysinger <vapier@g.o>
To: gentoo-catalyst@l.g.o
Subject: [gentoo-catalyst] [PATCH 1/3] main: group related command line flags
Date: Fri, 09 Oct 2015 05:57:37
Message-Id: 1444370248-13159-1-git-send-email-vapier@gentoo.org
1 This makes the --help output more manageable so people can quickly
2 scan and skip options that they don't care about.
3 ---
4 catalyst/main.py | 48 ++++++++++++++++++++++++++++--------------------
5 1 file changed, 28 insertions(+), 20 deletions(-)
6
7 diff --git a/catalyst/main.py b/catalyst/main.py
8 index 03c13c0..e6b6447 100644
9 --- a/catalyst/main.py
10 +++ b/catalyst/main.py
11 @@ -168,41 +168,49 @@ Using the specfile option (-f, --file) to build a stage target:
12 $ catalyst -f stage1-specfile.spec"""
13
14 parser = argparse.ArgumentParser(epilog=epilog, formatter_class=argparse.RawDescriptionHelpFormatter)
15 - parser.add_argument('-d', '--debug',
16 +
17 + parser.add_argument('-V', '--version',
18 + action='version', version=get_version(),
19 + help='display version information')
20 +
21 + group = parser.add_argument_group('Program output options')
22 + group.add_argument('-d', '--debug',
23 default=False, action='store_true',
24 help='enable debugging')
25 - parser.add_argument('-v', '--verbose',
26 + group.add_argument('-v', '--verbose',
27 default=False, action='store_true',
28 help='verbose output')
29 - parser.add_argument('-c', '--config',
30 - type=FilePath(),
31 - help='use specified configuration file')
32 - parser.add_argument('-f', '--file',
33 - type=FilePath(),
34 - help='read specfile')
35 - parser.add_argument('-F', '--fetchonly',
36 - default=False, action='store_true',
37 - help='fetch files only')
38 - parser.add_argument('-a', '--clear-autoresume',
39 +
40 + group = parser.add_argument_group('Temporary file management')
41 + group.add_argument('-a', '--clear-autoresume',
42 default=False, action='store_true',
43 help='clear autoresume flags')
44 - parser.add_argument('-p', '--purge',
45 + group.add_argument('-p', '--purge',
46 default=False, action='store_true',
47 help='clear tmp dirs, package cache, autoresume flags')
48 - parser.add_argument('-P', '--purgeonly',
49 + group.add_argument('-P', '--purgeonly',
50 default=False, action='store_true',
51 help='clear tmp dirs, package cache, autoresume flags and exit')
52 - parser.add_argument('-T', '--purgetmponly',
53 + group.add_argument('-T', '--purgetmponly',
54 default=False, action='store_true',
55 help='clear tmp dirs and autoresume flags and exit')
56 - parser.add_argument('-s', '--snapshot',
57 +
58 + group = parser.add_argument_group('Target/config file management')
59 + group.add_argument('-F', '--fetchonly',
60 + default=False, action='store_true',
61 + help='fetch files only')
62 + group.add_argument('-c', '--config',
63 + type=FilePath(),
64 + help='use specified configuration file')
65 + group.add_argument('-f', '--file',
66 + type=FilePath(),
67 + help='read specfile')
68 + group.add_argument('-s', '--snapshot',
69 help='generate a release snapshot')
70 - parser.add_argument('-V', '--version',
71 - action='version', version=get_version(),
72 - help='display version information')
73 - parser.add_argument('-C', '--cli',
74 + group.add_argument('-C', '--cli',
75 default=[], nargs=argparse.REMAINDER,
76 help='catalyst commandline (MUST BE LAST OPTION)')
77 +
78 return parser
79
80
81 --
82 2.5.2

Replies