Fix error when no arguments are specified (#240)

Also, introduce a metavar for the command subparser, since it's currently a bit verbose.
This commit is contained in:
thechief389 2018-08-23 02:34:27 -04:00 committed by Andrew Ekstedt
parent d17a772b4f
commit f413bf82f0

View file

@ -14,11 +14,12 @@ from pokedex import defaults
def main(junk, *argv): def main(junk, *argv):
if len(argv) <= 0:
command_help()
return
parser = create_parser() parser = create_parser()
if len(argv) <= 0:
parser.print_help()
sys.exit()
args = parser.parse_args(argv) args = parser.parse_args(argv)
args.func(parser, args) args.func(parser, args)
@ -62,7 +63,7 @@ def create_parser():
parents=[common_parser], parents=[common_parser],
) )
cmds = parser.add_subparsers(title='Commands') cmds = parser.add_subparsers(title='commands', metavar='<command>', help='commands')
cmd_help = cmds.add_parser( cmd_help = cmds.add_parser(
'help', help=u'Display this message', 'help', help=u'Display this message',
parents=[common_parser]) parents=[common_parser])