From 24eb3cbcf68e1ed034432d107aa6519386a99307 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 19 Aug 2012 19:41:16 +0200 Subject: display help if no arguments and not piped --- ponysay.py | 8 ++++---- 1 file 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 ''' -- cgit