summaryrefslogtreecommitdiffstats
path: root/ipalib/cli.py
diff options
context:
space:
mode:
authorJason Gerard DeRose <jderose@redhat.com>2008-10-21 17:35:42 -0600
committerJason Gerard DeRose <jderose@redhat.com>2008-10-21 17:35:42 -0600
commitf8ffede3b9443bf92e529fe2be20454f52df10c9 (patch)
tree0e55b3a38f71efa9fd0498eb546630838deba9d9 /ipalib/cli.py
parent5e0a0fa745433ef11d7c4ce2afbcbef401c96645 (diff)
parent245969858d8484428db1edbff8d6bd36587fb144 (diff)
downloadfreeipa.git-f8ffede3b9443bf92e529fe2be20454f52df10c9.tar.gz
freeipa.git-f8ffede3b9443bf92e529fe2be20454f52df10c9.tar.xz
freeipa.git-f8ffede3b9443bf92e529fe2be20454f52df10c9.zip
Merge branch 'master' of git://git.engineering.redhat.com/users/rcritten/freeipa2
Diffstat (limited to 'ipalib/cli.py')
-rw-r--r--ipalib/cli.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/ipalib/cli.py b/ipalib/cli.py
index 365eea20..ab7e3620 100644
--- a/ipalib/cli.py
+++ b/ipalib/cli.py
@@ -277,7 +277,10 @@ class CLI(object):
def run_cmd(self, cmd, argv):
kw = self.parse(cmd, argv)
- self.run_interactive(cmd, kw)
+ try:
+ self.run_interactive(cmd, kw)
+ except KeyboardInterrupt:
+ return
def run_interactive(self, cmd, kw):
for param in cmd.params():
@@ -325,11 +328,16 @@ class CLI(object):
usage=self.get_usage(cmd),
)
for option in cmd.options():
- parser.add_option('--%s' % to_cli(option.cli_name),
+ o = optparse.make_option('--%s' % to_cli(option.cli_name),
dest=option.name,
metavar=option.type.name.upper(),
help=option.doc,
)
+ if isinstance(option.type, ipa_types.Bool):
+ o.action = 'store_true'
+ o.default = option.default
+ o.type = None
+ parser.add_option(o)
return parser
def parse_globals(self, argv=sys.argv[1:]):