[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 @staticmethod
def process_multiple_args (callback, mnemonic): 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) print "Usage: %s %s..." % (sys.argv[0], mnemonic)
sys.exit (1) sys.exit (1)
@ -368,14 +368,13 @@ class UtilMains:
separator = " ", \ separator = " ", \
concat_separator = False): concat_separator = False):
if len (sys.argv) == 1 or ('--stdin' in sys.argv and len (sys.argv) != 2): if "--help" in sys.argv:
print "Usage:\n %s %s...\nor:\n %s --stdin" \ 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.argv[0], mnemonic, sys.argv[0])
sys.exit (1) sys.exit (1)
try: try:
if '--stdin' in sys.argv: if len (sys.argv) == 1:
sys.argv.remove ('--stdin')
while (1): while (1):
line = sys.stdin.readline () line = sys.stdin.readline ()
if not len (line): if not len (line):