diff options
author | Jason Gerard DeRose <jderose@redhat.com> | 2008-07-20 18:36:02 +0000 |
---|---|---|
committer | Jason Gerard DeRose <jderose@redhat.com> | 2008-07-20 18:36:02 +0000 |
commit | 14339cfae01b843949d0f9972670f56f952a5faa (patch) | |
tree | f37c378ee0ba619424f654bf345aa4faa30c7630 /ipa | |
parent | 89e9b7eaeca5e96d0fdeddf76fd74a2176d96d6f (diff) | |
download | freeipa-14339cfae01b843949d0f9972670f56f952a5faa.tar.gz freeipa-14339cfae01b843949d0f9972670f56f952a5faa.tar.xz freeipa-14339cfae01b843949d0f9972670f56f952a5faa.zip |
20: Updated example plugins, added '_api_' command to ipa script with prints the api
Diffstat (limited to 'ipa')
-rwxr-xr-x | ipa | 22 |
1 files changed, 19 insertions, 3 deletions
@@ -36,14 +36,30 @@ def print_commands(): def print_help(cmd): print 'Help on %s' % cmd +def print_api(): + print '\nCommands:' + for n in api.commands: + print ' %s' % n + + print '\nObjects:' + for obj in api.objects(): + print ' %s' % obj.name + for n in obj.commands: + print ' .%s()' % n + + print '%d objects' % len(api.objects) + print '%d commands' % len(api.commands) + + if len(sys.argv) < 2: print_commands() print 'Usage: ipa COMMAND [OPTIONS]' sys.exit(2) - cmd = sys.argv[1] - -if cmd not in api.commands: +if cmd == '_api_': + print_api() +elif cmd not in api.commands: print_commands() print 'ipa: ERROR: unknown command %r' % cmd sys.exit(2) +api.commands[cmd]() |