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:
parent
bab58a11ab
commit
ed9b3f98d2
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue