Store results in a set initially before processing
This commit is contained in:
parent
ea736c8978
commit
74c8cd5de5
@ -69,7 +69,7 @@ if __name__ == "__main__":
|
|||||||
"-d",
|
"-d",
|
||||||
"--directories-only",
|
"--directories-only",
|
||||||
action="store_const",
|
action="store_const",
|
||||||
const=["--type", "directories"],
|
const=["--type", "directory"],
|
||||||
dest="fd_extra_opts",
|
dest="fd_extra_opts",
|
||||||
help="filter results to directories",
|
help="filter results to directories",
|
||||||
)
|
)
|
||||||
@ -137,13 +137,13 @@ if __name__ == "__main__":
|
|||||||
for ext in args.extensions:
|
for ext in args.extensions:
|
||||||
FD_OPTS.extend(["--extension", ext])
|
FD_OPTS.extend(["--extension", ext])
|
||||||
|
|
||||||
files = []
|
files = set()
|
||||||
for pattern in args.patterns:
|
for pattern in args.patterns:
|
||||||
cmd = [FD_BIN, *FD_OPTS, pattern]
|
cmd = [FD_BIN, *FD_OPTS, pattern]
|
||||||
files.extend(
|
files.update(
|
||||||
subprocess.run(cmd, capture_output=True, text=True).stdout.splitlines()
|
subprocess.run(cmd, capture_output=True, text=True).stdout.splitlines()
|
||||||
)
|
)
|
||||||
files.sort()
|
files = sorted(files)
|
||||||
|
|
||||||
if files == []:
|
if files == []:
|
||||||
print(f"No results found, exiting")
|
print(f"No results found, exiting")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user