mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
256: Fixed cli.help plugin so it looks up commands in CLI instead of API
This commit is contained in:
@@ -45,20 +45,25 @@ def from_cli(cli_name):
|
|||||||
|
|
||||||
|
|
||||||
class help(public.Application):
|
class help(public.Application):
|
||||||
'Display help on command'
|
'Display help on command.'
|
||||||
def __call__(self, key):
|
def __call__(self, key):
|
||||||
if from_cli(key) not in self.api.Command:
|
key = str(key)
|
||||||
|
if key not in self.application:
|
||||||
print 'help: no such command %r' % key
|
print 'help: no such command %r' % key
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
print 'Help on command %r:' % key
|
cmd = self.application[key]
|
||||||
|
print 'Purpose: %s' % cmd.doc
|
||||||
|
if len(cmd.Option) > 0:
|
||||||
|
print '\nOptions:'
|
||||||
|
print ''
|
||||||
|
|
||||||
|
|
||||||
class console(public.Application):
|
class console(public.Application):
|
||||||
'Start IPA Interactive Python Console'
|
'Start the IPA Python console.'
|
||||||
|
|
||||||
def __call__(self):
|
def __call__(self):
|
||||||
code.interact(
|
code.interact(
|
||||||
'(Custom IPA Interactive Python Console)',
|
'(Custom IPA interactive Python console)',
|
||||||
local=dict(api=self.api)
|
local=dict(api=self.api)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -38,19 +38,19 @@ api.register(discover)
|
|||||||
|
|
||||||
# Register some methods for the 'user' object:
|
# Register some methods for the 'user' object:
|
||||||
class user_add(public.Method):
|
class user_add(public.Method):
|
||||||
'Add new user'
|
'Add a new user.'
|
||||||
api.register(user_add)
|
api.register(user_add)
|
||||||
|
|
||||||
class user_del(public.Method):
|
class user_del(public.Method):
|
||||||
'Delete existing user'
|
'Delete an existing user.'
|
||||||
api.register(user_del)
|
api.register(user_del)
|
||||||
|
|
||||||
class user_mod(public.Method):
|
class user_mod(public.Method):
|
||||||
'Edit existing user'
|
'Edit an existing user.'
|
||||||
api.register(user_mod)
|
api.register(user_mod)
|
||||||
|
|
||||||
class user_find(public.Method):
|
class user_find(public.Method):
|
||||||
'Search for users'
|
'Search for existing users.'
|
||||||
api.register(user_find)
|
api.register(user_find)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user