Commit 24f01f88 authored by Guillaume HEUSCH's avatar Guillaume HEUSCH

[config] correct handle of the --force option

parent ed1dcdf1
Pipeline #33442 passed with stage
in 6 minutes and 2 seconds
...@@ -133,13 +133,17 @@ def unset(substr, contain=False, force=False): ...@@ -133,13 +133,17 @@ def unset(substr, contain=False, force=False):
logger.error("The key containing '{}' was not found in the rc file".format(substr)) logger.error("The key containing '{}' was not found in the rc file".format(substr))
raise click.ClickException("Failed to change the configuration.") raise click.ClickException("Failed to change the configuration.")
click.echo("Registered for deletion:") if force:
for key in to_delete:
click.echo('- "{}" : "{}"'.format(key, rc[key]))
delete = click.confirm("Are you sure you want to delete all this ?")
if delete:
for key in to_delete: for key in to_delete:
del rc[key] del rc[key]
else:
click.echo("Registered for deletion:")
for key in to_delete:
click.echo('- "{}" : "{}"'.format(key, rc[key]))
delete = click.confirm("Are you sure you want to delete all this ?")
if delete:
for key in to_delete:
del rc[key]
_saverc(rc) _saverc(rc)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment