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 <mbasti@redhat.com>
This commit is contained in:
Petr Vobornik 2015-05-07 12:41:12 +02:00
parent 3b0e81ce06
commit 91b39acd6b

View File

@ -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: