sphinxext: Warn if namespace or command pattern invalid
Calling the Sphinx extension with an invalid namespace or command pattern currently results in a silent failure. Correct this oversight by raising a warning, which will cause a build failure is 'warning-is-error' is enabled. Change-Id: I63d18c86931d752c3a680e84a69df53bc04e7dfd Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
This commit is contained in:
parent
fa2de57c02
commit
857317d580
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in New Issue