[test] Make tool usage easier by not requiring "--stdin"
authorBehdad Esfahbod <behdad@behdad.org>
Sat, 12 May 2012 13:34:40 +0000 (15:34 +0200)
committerBehdad Esfahbod <behdad@behdad.org>
Sat, 12 May 2012 13:34:40 +0000 (15:34 +0200)
Just default to it.  Added "--help" instead to get usage.

test/shaping/hb_test_tools.py

index 3ff75b8..47fa6eb 100644 (file)
@@ -351,7 +351,7 @@ class UtilMains:
        @staticmethod
        def process_multiple_args (callback, mnemonic):
 
-               if len (sys.argv) == 1:
+               if len (sys.argv) == 1 or "--help" in sys.argv:
                        print "Usage: %s %s..." % (sys.argv[0], mnemonic)
                        sys.exit (1)
 
@@ -368,14 +368,13 @@ class UtilMains:
                                              separator = " ", \
                                              concat_separator = False):
 
-               if len (sys.argv) == 1 or ('--stdin' in sys.argv and len (sys.argv) != 2):
-                       print "Usage:\n  %s %s...\nor:\n  %s --stdin" \
+               if "--help" in sys.argv:
+                       print "Usage:\n  %s %s...\nor:\n  %s\n\nWhen called with no arguments, input is read from standard input." \
                              % (sys.argv[0], mnemonic, sys.argv[0])
                        sys.exit (1)
 
                try:
-                       if '--stdin' in sys.argv:
-                               sys.argv.remove ('--stdin')
+                       if len (sys.argv) == 1:
                                while (1):
                                        line = sys.stdin.readline ()
                                        if not len (line):