From cf0304ff26b12dd9c08299156311922b01b2b76b Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Sat, 6 May 2017 22:07:39 +0200 Subject: cosmetic: cmdline help: add line breaks, fix typo Fix typo 'patch' -> 'match' Argparse has a peculiar way of treating the cmdline help strings. Include explicit newlines in cmdline help, and place a comment explaining the details. Change-Id: I34a2333c55719986b729b07386bc47314635ee04 --- src/osmo-gsm-tester.py | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/src/osmo-gsm-tester.py b/src/osmo-gsm-tester.py index 31a342d..e38fae6 100755 --- a/src/osmo-gsm-tester.py +++ b/src/osmo-gsm-tester.py @@ -74,20 +74,32 @@ if __name__ == '__main__': import argparse parser = argparse.ArgumentParser(epilog=__doc__, formatter_class=argparse.RawTextHelpFormatter) + # Note: since we're using RawTextHelpFormatter to keep nicely separate + # paragraphs in the long help text, we unfortunately also need to take care + # of line wraps in the shorter cmdline options help. + # The line width here is what remains of screen width after the list of + # options placed by ArgumentParser. That's unfortunately subject to change + # and undefined, so when things change, just run a local + # ./osmo-gsm-tester.py --help and try to keep everything in 80 chars width. + # The help text is indented automatically, but line width is manual. + # Using multi-line strings here -- doesn't look nice in the python flow but + # is easiest to maintain. parser.add_argument('-V', '--version', action='store_true', help='Show version') parser.add_argument('trial_package', nargs='+', help='Directory containing binaries to test') parser.add_argument('-s', '--suite-scenario', dest='suite_scenario', action='append', - help='A suite-scenarios combination like suite:scenario+scenario') + help='''A suite-scenarios combination +like suite:scenario+scenario''') parser.add_argument('-S', '--series', dest='series', action='append', - help='A series of suite-scenarios combinations as defined in the' - ' osmo-gsm-tester configuration') + help='''A series of suite-scenarios combinations +as defined in the osmo-gsm-tester configuration''') parser.add_argument('-t', '--test', dest='test', action='append', - help='Run only tests matching this name. Any test name that' - ' contains the given string is run. To get an exact patch,' - ' prepend a "=" like "-t =my_exact_name". The ".py" suffix is' - ' always optional.') + help='''Run only tests matching this name. +Any test name that contains the given string is run. +To get an exact match, prepend a "=" like +"-t =my_exact_name". The ".py" suffix is always +optional.''') parser.add_argument('-l', '--log-level', dest='log_level', choices=log.LEVEL_STRS.keys(), default=None, help='Set logging level for all categories (on stdout)') -- cgit v1.2.3