mirror of
https://gitlab.com/kupfer/kupferbootstrap.git
synced 2025-02-23 13:45:45 -05:00
config.prompt_config(): fix changed
detection for lists due to conversion to comma-separated strings
This commit is contained in:
parent
e17a69ed81
commit
36b321aa2d
1 changed files with 3 additions and 1 deletions
|
@ -390,6 +390,8 @@ def prompt_config(
|
|||
whether the result is different, considering empty strings and None equal to each other.
|
||||
"""
|
||||
|
||||
original_default = default
|
||||
|
||||
def true_or_zero(to_check) -> bool:
|
||||
"""returns true if the value is truthy or int(0)"""
|
||||
zero = 0 # compiler complains about 'is with literal' otherwise
|
||||
|
@ -411,7 +413,7 @@ def prompt_config(
|
|||
text = click.style(text, bold=True)
|
||||
|
||||
result = click.prompt(text, type=field_type, default=default, value_proc=value_conv, show_default=True) # type: ignore
|
||||
changed = (result != default) and (true_or_zero(default) or true_or_zero(result))
|
||||
changed = result != (original_default if field_type == list else default) and (true_or_zero(default) or true_or_zero(result))
|
||||
if changed and echo_changes:
|
||||
print(f'value changed: "{text}" = "{result}"')
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue