From d6e1e15fcd6eb924320fdb8f3d8138aba9eae0c3 Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Wed, 10 Jun 2009 15:07:24 -0400 Subject: Add a one-character option for parameters --- ipalib/cli.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'ipalib/cli.py') diff --git a/ipalib/cli.py b/ipalib/cli.py index 1a1673e4..d1052370 100644 --- a/ipalib/cli.py +++ b/ipalib/cli.py @@ -739,7 +739,10 @@ class cli(backend.Executioner): kw['action'] = 'store_true' else: kw['metavar'] = metavar=option.__class__.__name__.upper() - o = optparse.make_option('--%s' % to_cli(option.cli_name), **kw) + if option.cli_short_name: + o = optparse.make_option('-%s' % option.cli_short_name, '--%s' % to_cli(option.cli_name), **kw) + else: + o = optparse.make_option('--%s' % to_cli(option.cli_name), **kw) parser.add_option(o) return parser -- cgit