diff --git a/gimmecert/decorators.py b/gimmecert/decorators.py index a5832e78ae08f209bb6f037239ecd1bcdecfe32c..d8ea0fce4ab436ddaf320d4da4bfcb76db7058ab 100644 --- a/gimmecert/decorators.py +++ b/gimmecert/decorators.py @@ -41,7 +41,7 @@ def subcommand_parser(func): having multiple code paths that deal with instantion and set-up of subcommand parsers. - The registerd functions are expected to accept two arguments: + The registered functions are expected to accept two arguments: - parser (ArgumentParser), instance of parent parser to which the subcommand (sub)parser belongs to. @@ -50,6 +50,9 @@ def subcommand_parser(func): should instantiate a subparser through it by calling the standard subparsers.add_parser() method. + The registered functions are expeceted to return the subparser + itself. + It is expected that each subcomand parser will set a default function to be invoked with parsed arguments by doing a call to set_defaults(func=subcommand_function). @@ -65,6 +68,8 @@ def subcommand_parser(func): subparser.set_defaults(func=mysubcommand) + return subparser + Later on the registered setup functions should be retrieved through get_subcommand_parser_setup_functions() function.