feat: add --no-random to forego the file order randomization

Kind of defeats the name of the project, huh
This commit is contained in:
2026-08-21 17:04:06 +03:00
parent da7ae925f2
commit 454d4a9003
+3
View File
@@ -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,6 +142,7 @@ 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)
if not self.no_random:
random.shuffle(self.usable_files) random.shuffle(self.usable_files)
if not self.usable_files: if not self.usable_files:
@@ -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()