mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Fix problems in help system
Fixes 3 issues: - If a topic has all its commands disabled, it should be disabled - If a command is disabled its help should be disabled - The show-mappings help was missing a doc string so no help was displayed https://fedorahosted.org/freeipa/ticket/1998
This commit is contained in:
@@ -748,6 +748,8 @@ class help(frontend.Local):
|
|||||||
self.print_commands(name)
|
self.print_commands(name)
|
||||||
elif name in self.Command:
|
elif name in self.Command:
|
||||||
cmd = self.Command[name]
|
cmd = self.Command[name]
|
||||||
|
if cmd.NO_CLI:
|
||||||
|
raise HelpError(topic=name)
|
||||||
print unicode(_('Purpose: %s')) % unicode(_(cmd.doc)).strip()
|
print unicode(_('Purpose: %s')) % unicode(_(cmd.doc)).strip()
|
||||||
self.Backend.cli.build_parser(cmd).print_help()
|
self.Backend.cli.build_parser(cmd).print_help()
|
||||||
elif mod_name in sys.modules:
|
elif mod_name in sys.modules:
|
||||||
@@ -805,6 +807,9 @@ class help(frontend.Local):
|
|||||||
m = '%s.%s' % (self._PLUGIN_BASE_MODULE, topic)
|
m = '%s.%s' % (self._PLUGIN_BASE_MODULE, topic)
|
||||||
doc = (unicode(_(sys.modules[m].__doc__)) or '').strip()
|
doc = (unicode(_(sys.modules[m].__doc__)) or '').strip()
|
||||||
|
|
||||||
|
if topic not in self.Command and len(commands) == 0:
|
||||||
|
raise HelpError(topic=topic)
|
||||||
|
|
||||||
print doc
|
print doc
|
||||||
if len(commands) > 1:
|
if len(commands) > 1:
|
||||||
print ''
|
print ''
|
||||||
@@ -814,6 +819,9 @@ class help(frontend.Local):
|
|||||||
print "\n"
|
print "\n"
|
||||||
|
|
||||||
class show_mappings(frontend.Command):
|
class show_mappings(frontend.Command):
|
||||||
|
"""
|
||||||
|
Show mapping of LDAP attributes to command-line option.
|
||||||
|
"""
|
||||||
takes_args = (
|
takes_args = (
|
||||||
Str('command_name',
|
Str('command_name',
|
||||||
label=_('Command name'),
|
label=_('Command name'),
|
||||||
|
|||||||
Reference in New Issue
Block a user