Skip to content

Commit 028ec34

Browse files
committed
Handle missing subcommand gracefully
1 parent 090b5b1 commit 028ec34

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

receptor/config.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,8 @@ def _enforce_value_type(self, value, value_type):
404404
def go(self):
405405
if not self._parsed_args:
406406
raise ReceptorRuntimeError("there are no parsed args yet")
407+
elif not hasattr(self._parsed_args, 'subparser_name'):
408+
raise ReceptorRuntimeError("you must specify a subcommand (%s)." % (", ".join(SUBCOMMAND_EXTRAS.keys()),))
407409
self._parsed_args.func(self)
408410

409411

0 commit comments

Comments
 (0)