From 5bc44650d66b2d055f9a3629a6e669dbbcf68295 Mon Sep 17 00:00:00 2001 From: Timmy Welch Date: Tue, 5 Sep 2023 03:56:56 -0400 Subject: [PATCH] Change --only-set-cv-key to --only-save-config --- comictaggerlib/ctsettings/commandline.py | 8 ++++---- comictaggerlib/ctsettings/settngs_namespace.py | 2 +- comictaggerlib/main.py | 15 ++++----------- 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/comictaggerlib/ctsettings/commandline.py b/comictaggerlib/ctsettings/commandline.py index 02841df..ebc58be 100644 --- a/comictaggerlib/ctsettings/commandline.py +++ b/comictaggerlib/ctsettings/commandline.py @@ -234,9 +234,9 @@ def register_commands(parser: settngs.Manager) -> None: file=False, ) parser.add_setting( - "--only-set-cv-key", + "--only-save-config", action="store_true", - help="Only set the Comic Vine API key and quit.", + help="Only save the configuration (eg, Comic Vine API key) and quit.", file=False, ) parser.add_setting( @@ -268,7 +268,7 @@ def validate_commandline_settings(config: settngs.Config[ct_ns], parser: settngs config[0].Commands_copy, config[0].Commands_rename, config[0].Commands_export_to_zip, - config[0].Commands_only_set_cv_key, + config[0].Commands_only_save_config, config[0].Commands_list_plugins, config[0].Runtime_Options_no_gui, ] @@ -284,7 +284,7 @@ def validate_commandline_settings(config: settngs.Config[ct_ns], parser: settngs config[0].Runtime_Options_files.extend(glob.glob(item)) if ( - not config[0].Commands_only_set_cv_key + not config[0].Commands_only_save_config and config[0].Runtime_Options_no_gui and not config[0].Runtime_Options_files ): diff --git a/comictaggerlib/ctsettings/settngs_namespace.py b/comictaggerlib/ctsettings/settngs_namespace.py index 285b86a..9d55fe6 100644 --- a/comictaggerlib/ctsettings/settngs_namespace.py +++ b/comictaggerlib/ctsettings/settngs_namespace.py @@ -15,7 +15,7 @@ class settngs_namespace(settngs.TypedNS): Commands_save: bool Commands_rename: bool Commands_export_to_zip: bool - Commands_only_set_cv_key: bool + Commands_only_save_config: bool Commands_list_plugins: bool Runtime_Options_config: comictaggerlib.ctsettings.types.ComicTaggerPaths diff --git a/comictaggerlib/main.py b/comictaggerlib/main.py index 8dbe91b..b351420 100644 --- a/comictaggerlib/main.py +++ b/comictaggerlib/main.py @@ -199,18 +199,11 @@ class App: self.list_plugins(list(talkers.values()), comicapi.comicarchive.archivers) return - # manage the CV API key - # None comparison is used so that the empty string can unset the value - if not error and ( - self.config[0].Source_comicvine_comicvine_key is not None - or self.config[0].Source_comicvine_comicvine_url is not None - ): - settings_path = self.config[0].Runtime_Options_config.user_config_dir / "settings.json" - if self.config_load_success: - self.manager.save_file(self.config[0], settings_path) - - if self.config[0].Commands_only_set_cv_key: + if self.config[0].Commands_only_save_config: if self.config_load_success: + settings_path = self.config[0].Runtime_Options_config.user_config_dir / "settings.json" + if self.config_load_success: + self.manager.save_file(self.config[0], settings_path) print("Key set") # noqa: T201 return