mirror of
https://github.com/veekun/pokedex.git
synced 2024-08-20 18:16:34 +00:00
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:
parent
d17a772b4f
commit
f413bf82f0
1 changed files with 6 additions and 5 deletions
|
@ -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])
|
||||||
|
|
Loading…
Reference in a new issue