summaryrefslogtreecommitdiffstats
path: root/ipa
diff options
context:
space:
mode:
authorJason Gerard DeRose <jderose@redhat.com>2008-07-20 18:36:02 +0000
committerJason Gerard DeRose <jderose@redhat.com>2008-07-20 18:36:02 +0000
commit14339cfae01b843949d0f9972670f56f952a5faa (patch)
treef37c378ee0ba619424f654bf345aa4faa30c7630 /ipa
parent89e9b7eaeca5e96d0fdeddf76fd74a2176d96d6f (diff)
downloadfreeipa-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-xipa22
1 files changed, 19 insertions, 3 deletions
diff --git a/ipa b/ipa
index e536e341e..91bdc021d 100755
--- a/ipa
+++ b/ipa
@@ -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]()