[tor-commits] [onionperf/master] Adds usage formatting for visualisation argument

karsten at torproject.org karsten at torproject.org
Wed Jun 3 13:39:29 UTC 2020


commit 15f41fefd15ac8810131291f36c29c6e8884c2fb
Author: Ana Custura <ana at netstat.org.uk>
Date:   Wed Jun 3 10:57:30 2020 +0100

    Adds usage formatting for visualisation argument
---
 onionperf/onionperf | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/onionperf/onionperf b/onionperf/onionperf
index 9c7f290..14a6661 100755
--- a/onionperf/onionperf
+++ b/onionperf/onionperf
@@ -87,6 +87,11 @@ logging.getLogger("stem").setLevel(logging.WARN)
 
 class CustomHelpFormatter(argparse.ArgumentDefaultsHelpFormatter):
     # adds the 'RawDescriptionHelpFormatter' to the ArgsDefault one
+    def _format_action(self, action):
+        parts = super()._format_action(action)
+        if '--data' in parts:
+             return parts.replace(' [LABEL ...]', '')
+        return parts
     def _fill_text(self, text, width, indent):
         return ''.join([indent + line for line in text.splitlines(True)])
 
@@ -281,7 +286,7 @@ files generated by this script will be written""",
         help="""Appends one or more PATHS to OnionPerf
                 analysis results files or directories of such files, and a LABEL
                 to be used for the graph legend for this dataset""",
-        metavar=("PATH", "LABEL"),
+        metavar=("PATH [PATH...] LABEL", "LABEL"),
         nargs='+',
         required="True",
         action=PathStringArgsAction, dest="datasets")





More information about the tor-commits mailing list