From 454d4a900338844f4f9375ae0ab314dcac5c6dd1 Mon Sep 17 00:00:00 2001 From: JustAnyone Date: Fri, 21 Aug 2026 17:04:06 +0300 Subject: [PATCH] feat: add --no-random to forego the file order randomization Kind of defeats the name of the project, huh --- random_file_picker/tui.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/random_file_picker/tui.py b/random_file_picker/tui.py index f303853..9e5c186 100644 --- a/random_file_picker/tui.py +++ b/random_file_picker/tui.py @@ -34,6 +34,7 @@ class Args(tap.TypedArgs): 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") 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") 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: files = worker.result or [] 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: status.update("❌ No usable files found") @@ -319,6 +321,7 @@ def main_with_tap(args: Args) -> None: whitelist=args.whitelist or [], use_geeqie=args.use_geeqie, use_trash=not args.no_trash, + no_random=args.no_random, ) app.run()