display help if no arguments and not piped

This commit is contained in:
Mattias Andrée 2012-08-19 19:41:16 +02:00
parent 5dde586850
commit 24eb3cbcf6

View file

@ -97,6 +97,10 @@ class Ponysay():
Starts the part of the program the arguments indicate Starts the part of the program the arguments indicate
''' '''
def __init__(self, args): def __init__(self, args):
if (args.argcount == 0) and not pipelinein:
args.help()
return
if (args.opts['-l'] is not None) and pipelineout: if (args.opts['-l'] is not None) and pipelineout:
args.opts['--onelist'] = args.opts['-l'] args.opts['--onelist'] = args.opts['-l']
args.opts['-l'] = None 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.add_variadic( ['-q', '--quote'], arg = "PONY", help = 'Select a ponies which will quote themself.')
opts.parse() opts.parse()
# TODO implement if [ -t 0 ] && [ $# == 0 ]; then
# usage
# exit
# fi
''' '''