From 74c8cd5de5f463670c9e7e428ffae5801b68783e Mon Sep 17 00:00:00 2001 From: Eric Torres Date: Sun, 17 Mar 2019 10:33:52 -0700 Subject: [PATCH] Store results in a set initially before processing --- quickdel.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/quickdel.py b/quickdel.py index 6fa88e1..b1fc73a 100644 --- a/quickdel.py +++ b/quickdel.py @@ -69,7 +69,7 @@ if __name__ == "__main__": "-d", "--directories-only", action="store_const", - const=["--type", "directories"], + const=["--type", "directory"], dest="fd_extra_opts", help="filter results to directories", ) @@ -137,13 +137,13 @@ if __name__ == "__main__": for ext in args.extensions: FD_OPTS.extend(["--extension", ext]) - files = [] + files = set() for pattern in args.patterns: cmd = [FD_BIN, *FD_OPTS, pattern] - files.extend( + files.update( subprocess.run(cmd, capture_output=True, text=True).stdout.splitlines() ) - files.sort() + files = sorted(files) if files == []: print(f"No results found, exiting")