diff --git a/bin/whisper-update.py b/bin/whisper-update.py index 80416f17..a62a6f43 100755 --- a/bin/whisper-update.py +++ b/bin/whisper-update.py @@ -16,16 +16,22 @@ now = int(time.time()) option_parser = optparse.OptionParser( - usage='''%prog [options] path timestamp:value [timestamp:value]*''') + usage='''%prog [options] path [timestamp:value]* + + If no values are passed as arguments, they are read one-per-line from stdin.''') (options, args) = option_parser.parse_args() -if len(args) < 2: +if not args: option_parser.print_help() sys.exit(1) path = args[0] -datapoint_strings = args[1:] +if len(args) >= 2: + datapoint_strings = args[1:] +else: + # no argv values, so read from stdin + datapoint_strings = sys.stdin datapoint_strings = [point.replace('N:', '%d:' % now) for point in datapoint_strings] datapoints = [tuple(point.split(':')) for point in datapoint_strings]