[test] Make tool usage easier by not requiring "--stdin"

Just default to it.  Added "--help" instead to get usage.
This commit is contained in:
Behdad Esfahbod 2012-05-12 15:34:40 +02:00
parent a3273e30bb
commit f538fcb538
1 changed files with 4 additions and 5 deletions

View 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):