From 1480224724864cb7cf34c9be755b905c61f885b9 Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Tue, 14 Oct 2008 01:45:30 -0600 Subject: Started roughing out user_add() using api.Backend.ldap; added Command.output_for_cli() to take care of formatting print output --- ipalib/frontend.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'ipalib/frontend.py') diff --git a/ipalib/frontend.py b/ipalib/frontend.py index 65b053e6c..da4fd00b1 100644 --- a/ipalib/frontend.py +++ b/ipalib/frontend.py @@ -486,6 +486,7 @@ class Command(plugable.Plugin): 'params', 'args_to_kw', 'kw_to_args', + 'output_for_cli', )) takes_options = tuple() takes_args = tuple() @@ -741,6 +742,14 @@ class Command(plugable.Plugin): multivalue = True yield arg + def output_for_cli(self, ret): + """ + Output result of this command to command line interface. + """ + assert type(ret) is dict, 'base output_for_cli() only works with dict' + for key in sorted(ret): + print '%s = %r' % (key, ret[key]) + class Object(plugable.Plugin): __public__ = frozenset(( -- cgit