aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2012-08-19 19:41:16 +0200
committerMattias Andrée <maandree@operamail.com>2012-08-19 19:41:16 +0200
commit24eb3cbcf68e1ed034432d107aa6519386a99307 (patch)
tree368d37a9567f340801787137ae8822d41e097e35
parent5dde58685012ffaa5e280e025b088a0dd3395ddc (diff)
downloadponysay-24eb3cbcf68e1ed034432d107aa6519386a99307.tar.gz
ponysay-24eb3cbcf68e1ed034432d107aa6519386a99307.tar.bz2
ponysay-24eb3cbcf68e1ed034432d107aa6519386a99307.zip
display help if no arguments and not piped
-rwxr-xr-xponysay.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/ponysay.py b/ponysay.py
index 65b8235..6fb522a 100755
--- a/ponysay.py
+++ b/ponysay.py
@@ -97,6 +97,10 @@ class Ponysay():
Starts the part of the program the arguments indicate
'''
def __init__(self, args):
+ if (args.argcount == 0) and not pipelinein:
+ args.help()
+ return
+
if (args.opts['-l'] is not None) and pipelineout:
args.opts['--onelist'] = args.opts['-l']
args.opts['-l'] = None
@@ -778,10 +782,6 @@ opts.add_argumented( ['-f', '--pony'], arg = "PONY", help = 'Select a po
opts.add_variadic( ['-q', '--quote'], arg = "PONY", help = 'Select a ponies which will quote themself.')
opts.parse()
-# TODO implement if [ -t 0 ] && [ $# == 0 ]; then
-# usage
-# exit
-# fi
'''