summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS2
-rw-r--r--cliapp/app.py2
2 files changed, 4 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index b73544a..6e236f8 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,8 @@ Version 1.UNRELEASED
"help".
* `ssh_runcmd` now has the `tty` keyword argument to enable ssh
allocation of pseudo-TTYs. Patch from Jannis Pohlmann.
+* The `help` subcommand now writes a useful error message, instead of
+ a stack trace, if given an unknown subcommand. Reported by Rob Taylor.
Version 1.20130424
------------------
diff --git a/cliapp/app.py b/cliapp/app.py
index 42b120e..8e280af 100644
--- a/cliapp/app.py
+++ b/cliapp/app.py
@@ -350,6 +350,8 @@ class Application(object):
return '* %%prog %s: %s\n' % (cmd, summary)
def _format_subcommand_help(self, cmd): # pragma: no cover
+ if cmd not in self.subcommands:
+ raise cliapp.AppException('Unknown subcommand %s' % cmd)
method = self.subcommands[cmd]
doc = method.__doc__ or ''
t = doc.split('\n', 1)