summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2018-02-09 14:18:21 +0000
committerGerrit Code Review <review@openstack.org>2018-02-09 14:18:21 +0000
commitbe3c326f55277ef3c52262b53c112ba7c3f5a933 (patch)
tree0b034e2ccc136d0a79d2ee823a3d459016bb10db
parenta82236f4314db03040078a53c31d607faeba9948 (diff)
parent857317d5804cdda8c3f4fca949bcf97ed26d7c10 (diff)
downloadcliff-be3c326f55277ef3c52262b53c112ba7c3f5a933.tar.gz
Merge "sphinxext: Warn if namespace or command pattern invalid"
-rw-r--r--cliff/sphinxext.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/cliff/sphinxext.py b/cliff/sphinxext.py
index d8468b6..5ec3448 100644
--- a/cliff/sphinxext.py
+++ b/cliff/sphinxext.py
@@ -268,6 +268,15 @@ class AutoprogramCliffDirective(rst.Directive):
if fnmatch.fnmatch(x, command_pattern)]
else:
commands = manager.commands.keys()
+
+ if not commands:
+ msg = 'No commands found in the "{}" namespace'
+ if command_pattern:
+ msg += ' using the "{}" command name/pattern'
+ msg += ('. Are you sure this is correct and the application being '
+ 'documented is installed?')
+ raise self.warning(msg.format(self.arguments[0], command_pattern))
+
return dict((name, self._load_command(manager, name))
for name in commands)