config: if option value was previously set, ignore from options value

This commit is contained in:
Benjamin Renard 2023-01-10 10:50:48 +01:00
parent 5fefc1ed84
commit 56162452ac
1 changed files with 3 additions and 3 deletions

View File

@ -43,6 +43,7 @@ class BaseOption: # pylint: disable=too-many-instance-attributes
self.arg = arg
self.short_arg = short_arg
self.arg_help = arg_help if arg_help else comment
self._set = False
@property
def _isset_in_options(self):
@ -93,7 +94,7 @@ class BaseOption: # pylint: disable=too-many-instance-attributes
def get(self):
""" Get option value from options, config or default """
if self._isset_in_options:
if self._isset_in_options and not self._set:
return self._from_options
if self._isset_in_config_file:
return self._from_config
@ -118,8 +119,7 @@ class BaseOption: # pylint: disable=too-many-instance-attributes
self.section.name, self.name, self.to_config(value)
)
if self.config.options and not self.no_arg:
setattr(self.config.options, self.parser_dest, value)
self._set = True
@property
def parser_action(self):