Remove unnecessary dest arguments in settings

This commit is contained in:
Timmy Welch 2024-01-22 17:00:59 -08:00
parent 085543321a
commit fbe56f4db9
6 changed files with 9 additions and 12 deletions

View File

@ -599,7 +599,7 @@ class CLI:
return Result(Action.rename, Status.read_failure, original_path)
new_ext = "" # default
if self.config.File_Rename__set_extension_based_on_archive:
if self.config.File_Rename__auto_extension:
new_ext = ca.extension()
renamer = FileRenamer(
@ -674,7 +674,7 @@ class CLI:
export_success = False
if not self.config.Runtime_Options__dryrun:
if export_success := ca.export_as_zip(new_file):
if self.config.Runtime_Options__delete_after_zip_export:
if self.config.Runtime_Options__delete_original:
try:
filename_path.unlink(missing_ok=True)
delete_success = True
@ -685,7 +685,7 @@ class CLI:
new_file.unlink(missing_ok=True)
else:
msg = msg_hdr + f"Dry-run: Would try to create {os.path.split(new_file)[1]}"
if self.config.Runtime_Options__delete_after_zip_export:
if self.config.Runtime_Options__delete_original:
msg += " and delete original."
self.output(msg)
return Result(Action.export, Status.success, ca.path, new_file)
@ -693,7 +693,7 @@ class CLI:
msg = msg_hdr
if export_success:
msg += f"Archive exported successfully to: {os.path.split(new_file)[1]}"
if self.config.Runtime_Options__delete_after_zip_export and delete_success:
if self.config.Runtime_Options__delete_original and delete_success:
msg += " (Original deleted) "
else:
msg += "Archive failed to export!"

View File

@ -78,7 +78,6 @@ def register_runtime(parser: settngs.Manager) -> None:
parser.add_setting(
"--delete-original",
action="store_true",
dest="delete_after_zip_export",
help="""Delete original archive after successful\nexport to Zip. (only relevant for -e)""",
file=False,
)
@ -172,7 +171,6 @@ def register_runtime(parser: settngs.Manager) -> None:
)
parser.add_setting(
"--overwrite",
dest="overwrite",
action=argparse.BooleanOptionalAction,
default=True,
help="""Apply metadata to already tagged archives (relevant for -s or -c).""",

View File

@ -184,7 +184,6 @@ def rename(parser: settngs.Manager) -> None:
)
parser.add_setting(
"--auto-extension",
dest="set_extension_based_on_archive",
default=True,
action=argparse.BooleanOptionalAction,
help="Automatically sets the extension based on the archive type e.g. cbr for rar, cbz for zip",

View File

@ -16,7 +16,7 @@ class settngs_namespace(settngs.TypedNS):
Runtime_Options__config: comictaggerlib.ctsettings.types.ComicTaggerPaths
Runtime_Options__verbose: int
Runtime_Options__abort_on_conflict: bool
Runtime_Options__delete_after_zip_export: bool
Runtime_Options__delete_original: bool
Runtime_Options__parse_filename: bool
Runtime_Options__issue_id: str
Runtime_Options__online: bool
@ -83,7 +83,7 @@ class settngs_namespace(settngs.TypedNS):
File_Rename__template: str
File_Rename__issue_number_padding: int
File_Rename__use_smart_string_cleanup: bool
File_Rename__set_extension_based_on_archive: bool
File_Rename__auto_extension: bool
File_Rename__dir: str
File_Rename__move_to_dir: bool
File_Rename__strict: bool

View File

@ -76,7 +76,7 @@ class RenameWindow(QtWidgets.QDialog):
self.renamer.replacements = self.config[0].File_Rename__replacements
new_ext = ca.path.suffix # default
if self.config[0].File_Rename__set_extension_based_on_archive:
if self.config[0].File_Rename__auto_extension:
new_ext = ca.extension()
if md is None:

View File

@ -407,7 +407,7 @@ class SettingsWindow(QtWidgets.QDialog):
self.leRenameTemplate.setText(self.config[0].File_Rename__template)
self.leIssueNumPadding.setText(str(self.config[0].File_Rename__issue_number_padding))
self.cbxSmartCleanup.setChecked(self.config[0].File_Rename__use_smart_string_cleanup)
self.cbxChangeExtension.setChecked(self.config[0].File_Rename__set_extension_based_on_archive)
self.cbxChangeExtension.setChecked(self.config[0].File_Rename__auto_extension)
self.cbxMoveFiles.setChecked(self.config[0].File_Rename__move_to_dir)
self.leDirectory.setText(self.config[0].File_Rename__dir)
self.cbxRenameStrict.setChecked(self.config[0].File_Rename__strict)
@ -525,7 +525,7 @@ class SettingsWindow(QtWidgets.QDialog):
self.config[0].File_Rename__template = str(self.leRenameTemplate.text())
self.config[0].File_Rename__issue_number_padding = int(self.leIssueNumPadding.text())
self.config[0].File_Rename__use_smart_string_cleanup = self.cbxSmartCleanup.isChecked()
self.config[0].File_Rename__set_extension_based_on_archive = self.cbxChangeExtension.isChecked()
self.config[0].File_Rename__auto_extension = self.cbxChangeExtension.isChecked()
self.config[0].File_Rename__move_to_dir = self.cbxMoveFiles.isChecked()
self.config[0].File_Rename__dir = self.leDirectory.text()