commit: 4f03ed0fc2f6f7b076758f35ca83334cecd407eb Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org> AuthorDate: Thu Dec 25 22:04:07 2014 +0000 Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com> CommitDate: Thu Dec 25 22:04:07 2014 +0000 URL: http://sources.gentoo.org/gitweb/?p=proj/gentoo-keys.git;a=commit;h=4f03ed0f
gkeys/base.py: Fix >=py3.3 argparse regression handling subparsers --- gkeys/gkeys/base.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gkeys/gkeys/base.py b/gkeys/gkeys/base.py index 5ad92e7..4184cfc 100644 --- a/gkeys/gkeys/base.py +++ b/gkeys/gkeys/base.py @@ -180,7 +180,12 @@ class CliBase(object): action_parser.set_defaults(action=name) self._add_options(action_parser, self.cli_config['Action_Options'][name]) - return parser.parse_args(args) + parsed_args = parser.parse_args(args) + action = getattr(parsed_args, 'action', None) + if not action: + parser.print_help() + sys.exit(1) + return parsed_args def _add_options(self, parser, options):