mirror of
https://github.com/freedomofpress/dangerzone.git
synced 2025-04-28 09:52:37 +02:00
Add a way to unset the container runtime
Add a way to set the container runtime that Dangerzone uses back to the default.
This commit is contained in:
parent
1a644e2506
commit
57667a96be
2 changed files with 19 additions and 5 deletions
|
@ -52,7 +52,11 @@ def print_header(s: str) -> None:
|
|||
@click.option(
|
||||
"--set-container-runtime",
|
||||
required=False,
|
||||
help="The path to the container runtime you want to set in the settings",
|
||||
help=(
|
||||
"The name or full path of the container runtime you want Dangerzone to use."
|
||||
" You can specify the value 'default' if you want to take back your choice, and"
|
||||
" let Dangerzone use the default runtime for this OS"
|
||||
),
|
||||
)
|
||||
@click.version_option(version=get_version(), message="%(version)s")
|
||||
@errors.handle_document_errors
|
||||
|
@ -69,6 +73,12 @@ def cli_main(
|
|||
display_banner()
|
||||
if set_container_runtime:
|
||||
settings = Settings()
|
||||
if set_container_runtime == "default":
|
||||
settings.unset_custom_runtime()
|
||||
click.echo(
|
||||
"Instructed Dangerzone to use the default container runtime for this OS"
|
||||
)
|
||||
else:
|
||||
container_runtime = settings.set_custom_runtime(
|
||||
set_container_runtime, autosave=True
|
||||
)
|
||||
|
|
|
@ -52,6 +52,10 @@ class Settings:
|
|||
self.save()
|
||||
return container_runtime
|
||||
|
||||
def unset_custom_runtime(self) -> None:
|
||||
self.settings.pop("container_runtime")
|
||||
self.save()
|
||||
|
||||
def get(self, key: str) -> Any:
|
||||
return self.settings[key]
|
||||
|
||||
|
|
Loading…
Reference in a new issue