Handle no arguments

Running 'pbrx' with no arguments is a thing folks may do. We shouldn't
throw exceptions at them in this case, but, instead, some help text.

Change-Id: Ibed0da165f062125cf298e2d9b3dce54c4b93420
This commit is contained in:
David Shrewsbury 2018-07-11 12:56:09 -04:00
parent bab58a11ab
commit ed9b3f98d2
1 changed files with 7 additions and 2 deletions

View File

@ -82,7 +82,8 @@ def main():
)
subparsers = parser.add_subparsers(
title="commands", description="valid commands", help="additional help"
title="commands", description="valid commands",
dest="command", help="additional help"
)
cmd_siblings = subparsers.add_parser(
@ -110,9 +111,13 @@ def main():
args = parser.parse_args()
setup_logging(args.log_config, args.debug)
if not args.command:
parser.print_help()
return 1
try:
return args.func(args)
except Exception as e:
log.exception(str(e))
return 1