Commit c9e23b19 authored by Mathieu Giraud's avatar Mathieu Giraud

src/ -h, bikeshed option help messages and grouping

parent 6df6bebb
......@@ -242,16 +242,17 @@ for (mod_char, mod_long, mod_help) in MODIFIERS:
parser = ArgParser(description='Test command-line applications through .should files',
epilog='''Example (see also and demo/*.should):
%(prog)s demo/hello.should''',
parser.add_argument('--version', action='version',
version='%(prog)s {version}'.format(version=__version__))
options = ArgParser(fromfile_prefix_chars='@') # Can be used in !OPTIONS: directive
for p in (parser, options):
group = parser.add_argument_group('running tests (can also be set per test in !OPTIONS)')
for p in (group, options):
p.add_argument('--cd', metavar='PATH', help='directory from which to run the test commands')
p.add_argument('--cd-same', action='store_true', help='run the test commands from the same directory as the .should files')
p.add_argument('--launcher', metavar='CMD', default='', help='launcher preceding each command (or replacing %s)' % VAR_LAUNCHER)
......@@ -260,14 +261,15 @@ for p in (parser, options):
p.add_argument('--var', metavar='NAME=value', action='append', help='variable definition (then use $NAME in .should files)')
p.add_argument('--timeout', type=int, default = TIMEOUT, help = 'Delay (in seconds) after which the task is stopped (default: %(default)d)')
parser.add_argument('--shuffle', action='store_true', help='shuffle the tests')
group = parser.add_argument_group('filter options')
group = parser.add_argument_group('selecting tests to be run')
group.add_argument('--shuffle', action='store_true', help='shuffle the tests')
group.add_argument('--only-a', action='store_true', help="launches only 'a' tests")
group.add_argument('--only-f', action='store_true', help="launches only 'f' tests")
output = parser.add_argument_group('output options')
group.add_argument(RETRY_FLAG, action='store_true', help='launches only the last failed or warned tests')
output = parser.add_argument_group('controlling output')
output.add_argument('--log', action='append_const', dest='output', const=OUT_LOG, help='stores the output into .log files')
output.add_argument('--tap', action='append_const', dest='output', const=OUT_TAP, help='outputs .tap files')
......@@ -275,8 +277,12 @@ output.add_argument('--xml', action='append_const', dest='output', const=OUT_XML
output.add_argument('-v', '--verbose', action='count', help='increase verbosity', default=1)
output.add_argument('-q', '--quiet', action='store_const', dest='verbose', const=0, help='verbosity to zero')
output.add_argument("-h", "--help", action="help", help="show this help message and exit")
output.add_argument('--version', action='version',
version='%(prog)s {version}'.format(version=__version__))
parser.add_argument('file', metavar='should-file', nargs='+', help='''input files (.should)''')
parser.add_argument(RETRY_FLAG, action='store_true', help='launch again the last failed or warned tests')
class ShouldException(BaseException):
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment