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")
|
||||
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,6 +142,7 @@ class MenuApp(App[None]):
|
||||
if event.state == WorkerState.SUCCESS:
|
||||
files = worker.result or []
|
||||
self.usable_files = list(files)
|
||||
if not self.no_random:
|
||||
random.shuffle(self.usable_files)
|
||||
|
||||
if not self.usable_files:
|
||||
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user