[tor-commits] [onionperf/master] Print out help if no argument is given.

karsten at torproject.org karsten at torproject.org
Wed May 13 19:26:28 UTC 2020


commit 52d9c2f02751530cd7767b99acd419654156b5a7
Author: Karsten Loesing <karsten.loesing at gmx.net>
Date:   Wed May 13 21:25:08 2020 +0200

    Print out help if no argument is given.
    
    This has changed since moving from Python 2 to 3.
    
    Patch by acute. Fixes #34208.
---
 onionperf/onionperf | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/onionperf/onionperf b/onionperf/onionperf
index cb1899c..a61fd73 100755
--- a/onionperf/onionperf
+++ b/onionperf/onionperf
@@ -347,8 +347,12 @@ files generated by this script will be written""",
         default=util.LINEFORMATS)
 
     # get args and call the command handler for the chosen mode
-    args = main_parser.parse_args()
-    args.func(args)
+    if len(sys.argv) == 1:
+        main_parser.print_help()
+        sys.exit(1)
+    else:
+        args = main_parser.parse_args()
+        args.func(args)
 
 def monitor(args):
     from onionperf.monitor import TorMonitor



More information about the tor-commits mailing list