From 91b39acd6bca1a1054220291f4b4a0a4118e829c Mon Sep 17 00:00:00 2001 From: Petr Vobornik Date: Thu, 7 May 2015 12:41:12 +0200 Subject: cli: differentiate Flag a Bool when autofill is set With previous behavior there was no difference between Flag and Bool if - autofill == True - default = some value It prevented to have a boolean which is set by default to true, but could be set to False if users wants to without prompting in interactive shell. Reviewed-By: Martin Basti --- ipalib/cli.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ipalib/cli.py') diff --git a/ipalib/cli.py b/ipalib/cli.py index bbf616d14..fc6e23039 100644 --- a/ipalib/cli.py +++ b/ipalib/cli.py @@ -48,7 +48,7 @@ from errors import (PublicError, CommandError, HelpError, InternalError, NoSuchNamespaceError, ValidationError, NotFound, NotConfiguredError, PromptFailed) from constants import CLI_TAB, LDAP_GENERALIZED_TIME_FORMAT -from parameters import File, Str, Enum, Any +from parameters import File, Str, Enum, Any, Flag from text import _ from ipapython.version import API_VERSION from ipapython.dnsutil import DNSName @@ -1150,7 +1150,7 @@ class cli(backend.Executioner): continue if option.password and self.env.interactive: kw['action'] = 'store_true' - elif option.type is bool and option.autofill: + elif isinstance(option, Flag): if option.default is True: kw['action'] = 'store_false' else: -- cgit