Exit cleanly if no command is provided.

This commit is contained in:
kris 2019-09-17 12:47:39 +01:00
parent 74db8e5fe6
commit a9c6967e4f
1 changed files with 2 additions and 0 deletions

View File

@ -971,6 +971,8 @@ See '""" + __progname__ + """ <command> -h' for help on individual commands.""",
sp = parser.add_subparsers(dest="command", help="command")
for command in cmds:
command.setup(sp)
if not args:
parser.error("Command is required.")
args = parser.parse_args(args)
args.action(args)