Added --force to timewarp to bypass confirmation

This commit is contained in:
Rhet Turnbull
2022-05-02 08:06:48 -07:00
parent ac67ef2384
commit f42bee84c0

View File

@@ -399,6 +399,11 @@ if the EXIF data is missing, use the file modification date/time; show verbose o
is_flag=True, is_flag=True,
help="Plain text mode. Do not use rich output.", help="Plain text mode. Do not use rich output.",
) )
@click.option(
"--force",
is_flag=True,
help="Bypass confirmation prompt. Use with caution.",
)
def timewarp( def timewarp(
date, date,
date_delta, date_delta,
@@ -421,6 +426,7 @@ def timewarp(
output_file, output_file,
terminal_width, terminal_width,
timestamp, timestamp,
force,
): ):
"""Adjust date/time/timezone of photos in Apple Photos. """Adjust date/time/timezone of photos in Apple Photos.
@@ -516,12 +522,27 @@ def timewarp(
sys.exit(1) sys.exit(1)
# confirm with user before proceeding # confirm with user before proceeding
if (
any(
[
date,
date_delta,
time,
time_delta,
timezone,
push_exif,
pull_exif,
function,
]
)
and not force
):
click.confirm( click.confirm(
rich_text( rich_text(
f":warning-emoji: About to process [num]{len(photos)}[/] {pluralize(len(photos), 'photo', 'photos')} with timewarp. " f":warning-emoji: About to process [num]{len(photos)}[/] {pluralize(len(photos), 'photo', 'photos')} with timewarp. "
"This will directly modify your Photos library database using undocumented features. " "This will directly modify your Photos library database using undocumented features. "
"While this feature has been well tested, it is possible this may " "While this functionality has been well tested, it is possible this may "
"corrupt, damage, or destroy your Photos library. Use at your own caution. " "corrupt, damage, or destroy your Photos library. [bold]Use at your own caution. No warranty is implied or provided.[/] "
"It is strongly recommended you make a backup of your Photos library before using the timewarp command " "It is strongly recommended you make a backup of your Photos library before using the timewarp command "
"(for example, using Time Machine).\n\n" "(for example, using Time Machine).\n\n"
"Proceed with timewarp?" "Proceed with timewarp?"
@@ -672,6 +693,3 @@ def timewarp(
progress.advance(task) progress.advance(task)
rich_echo("Done.") rich_echo("Done.")
# if output_file:
# output_file.close()