From 7273d48169a6c0dabc1bfb0f42bafb06515fdac9 Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Mon, 21 Jul 2008 01:44:59 +0000 Subject: 26: Added AbstractCommand.get_doc() method to return the gettext translated summary of command; added get_doc() method to all example --- ipa | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) (limited to 'ipa') 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: -- cgit