diff --git a/README.markdown b/README.markdown index 66efecb..7f97875 100644 --- a/README.markdown +++ b/README.markdown @@ -9,6 +9,8 @@ Installing form github `pip install -e git://github.com/bitly/data_hacks.git#egg Installing from source `python setup.py install` +data_hacks are friendly. Ask them for usage information with `--help` + histogram.py ------------ diff --git a/data_hacks/nintey_five_percent.py b/data_hacks/nintey_five_percent.py index 78dd85b..56dfc3e 100644 --- a/data_hacks/nintey_five_percent.py +++ b/data_hacks/nintey_five_percent.py @@ -56,7 +56,7 @@ def calc_95(data, count): return t if __name__ == "__main__": - if sys.stdin.isatty(): - print "Usage: cat data | %(prog)s" % os.path.basename(sys.argv[0]) + if sys.stdin.isatty() or '--help' in sys.argv or '-h' in sys.argv: + print "Usage: cat data | %s" % os.path.basename(sys.argv[0]) sys.exit(1) run() diff --git a/data_hacks/run_for.py b/data_hacks/run_for.py index 47277ac..55c4259 100644 --- a/data_hacks/run_for.py +++ b/data_hacks/run_for.py @@ -51,8 +51,8 @@ def run(runtime): return if __name__ == "__main__": - usage = "Usage: tail -f access.log | %(prog)s [time] | ..." % os.path.basename(sys.argv[0]) - help = "time can be in the format 10s 10m 10h etc" + usage = "Usage: tail -f access.log | %s [time] | ..." % os.path.basename(sys.argv[0]) + help = "time can be in the format 10s, 10m, 10h, etc" if sys.stdin.isatty(): print usage print help