[MERGED] osmo-gsm-tester[master]: cosmetic: cmdline help: add line breaks, fix typo

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Fri May 12 12:41:56 UTC 2017


Pau Espin Pedrol has submitted this change and it was merged.

Change subject: cosmetic: cmdline help: add line breaks, fix typo
......................................................................


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
---
M src/osmo-gsm-tester.py
1 file changed, 19 insertions(+), 7 deletions(-)

Approvals:
  Pau Espin Pedrol: Looks good to me, approved
  Jenkins Builder: Verified



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 @@
     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)')

-- 
To view, visit https://gerrit.osmocom.org/2495
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I34a2333c55719986b729b07386bc47314635ee04
Gerrit-PatchSet: 5
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>



More information about the gerrit-log mailing list