summaryrefslogtreecommitdiffstats
path: root/ipa
diff options
context:
space:
mode:
authorJason Gerard DeRose <jderose@redhat.com>2008-07-21 01:44:59 +0000
committerJason Gerard DeRose <jderose@redhat.com>2008-07-21 01:44:59 +0000
commit7273d48169a6c0dabc1bfb0f42bafb06515fdac9 (patch)
tree024a1ecf671d046a5330ba98b2f7e7327fd956e3 /ipa
parent48c7da47c78c5b5f97dc01a7593313943aef7b6e (diff)
downloadfreeipa-7273d48169a6c0dabc1bfb0f42bafb06515fdac9.tar.gz
freeipa-7273d48169a6c0dabc1bfb0f42bafb06515fdac9.tar.xz
freeipa-7273d48169a6c0dabc1bfb0f42bafb06515fdac9.zip
26: Added AbstractCommand.get_doc() method to return the gettext translated summary of command; added get_doc() method to all example
Diffstat (limited to 'ipa')
-rwxr-xr-xipa37
1 files changed, 23 insertions, 14 deletions
diff --git a/ipa b/ipa
index c253abee0..6faa1648e 100755
--- a/ipa
+++ b/ipa
@@ -21,37 +21,46 @@
"""
Command Line Interface to IPA.
+
+Just proof of concept stuff in here right now.
"""
import sys
from ipalib.startup import api
+def _(msg):
+ """
+ Dummy gettext function for testing.
+ """
+ return msg
+
+
def print_commands():
print 'Commands:'
m = api.max_cmd_len
- for c in api.commands:
- c = c.replace('_', '-')
- print ' %s The help on %s' % (c.ljust(m), c)
+ for cmd in api.commands():
+ print ' %s %s' % (cmd.cli_name.ljust(m), cmd.get_doc(_))
def print_help(cmd):
print 'Help on %s' % cmd
def print_api():
- print '\nCommands:'
- for n in api.commands:
- print ' %s' % n
+ print 'Commands:'
+ for cmd in api.commands():
+ print ' %s [%s]' % (cmd.name, cmd.loc)
- print '\nObjects:'
+ print 'Objects:'
for obj in api.objects():
- print ' %s' % obj.name
- for n in obj.methods:
- print ' .%s()' % n
- for n in obj.properties:
- print ' .%s' % n
+ print ' %s [%s]' % (obj.name, obj.loc)
+ for meth in obj.methods():
+ print ' .%s() [%s]' % (meth.attr_name, meth.loc)
+ for prop in obj.properties():
+ print ' .%s [%s]' % (prop.attr_name, prop.loc)
- print '\nStats:'
- print ' %d objects' % len(api.objects)
+ print 'Stats:'
print ' %d commands' % len(api.commands)
+ print ' %d objects' % len(api.objects)
+
if len(sys.argv) < 2: