feat: add --no-random to forego the file order randomization
Kind of defeats the name of the project, huh
This commit is contained in:
@@ -34,6 +34,7 @@ class Args(tap.TypedArgs):
|
|||||||
recursive: bool = tap.arg("-r", "--recursive", "--descend", default=False, help="Whether to recurse into subdirectories")
|
recursive: bool = tap.arg("-r", "--recursive", "--descend", default=False, help="Whether to recurse into subdirectories")
|
||||||
use_geeqie: bool = tap.arg("--use-geeqie", default=False, help="Whether to use Geeqie as the image viewer")
|
use_geeqie: bool = tap.arg("--use-geeqie", default=False, help="Whether to use Geeqie as the image viewer")
|
||||||
no_trash: bool = tap.arg("--no-trash", default=False, help="Delete files immediately without moving to trash")
|
no_trash: bool = tap.arg("--no-trash", default=False, help="Delete files immediately without moving to trash")
|
||||||
|
no_random: bool = tap.arg("--no-random", default=False, help="Do not randomize the order of files")
|
||||||
blacklist: list[str] | None = tap.arg("--blacklist", nargs="*", help="List of glob patterns to blacklist files")
|
blacklist: list[str] | None = tap.arg("--blacklist", nargs="*", help="List of glob patterns to blacklist files")
|
||||||
whitelist: list[str] | None = tap.arg("--whitelist", nargs="*", help="List of glob patterns to whitelist files")
|
whitelist: list[str] | None = tap.arg("--whitelist", nargs="*", help="List of glob patterns to whitelist files")
|
||||||
|
|
||||||
@@ -141,7 +142,8 @@ class MenuApp(App[None]):
|
|||||||
if event.state == WorkerState.SUCCESS:
|
if event.state == WorkerState.SUCCESS:
|
||||||
files = worker.result or []
|
files = worker.result or []
|
||||||
self.usable_files = list(files)
|
self.usable_files = list(files)
|
||||||
random.shuffle(self.usable_files)
|
if not self.no_random:
|
||||||
|
random.shuffle(self.usable_files)
|
||||||
|
|
||||||
if not self.usable_files:
|
if not self.usable_files:
|
||||||
status.update("❌ No usable files found")
|
status.update("❌ No usable files found")
|
||||||
@@ -319,6 +321,7 @@ def main_with_tap(args: Args) -> None:
|
|||||||
whitelist=args.whitelist or [],
|
whitelist=args.whitelist or [],
|
||||||
use_geeqie=args.use_geeqie,
|
use_geeqie=args.use_geeqie,
|
||||||
use_trash=not args.no_trash,
|
use_trash=not args.no_trash,
|
||||||
|
no_random=args.no_random,
|
||||||
)
|
)
|
||||||
app.run()
|
app.run()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user