🛠️ Add pyproject.toml and use uv
This commit is contained in:
parent
82248deb8d
commit
fccb0a672d
5 changed files with 41 additions and 5 deletions
31
main.py
Normal file
31
main.py
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
import subprocess
|
||||
import collections
|
||||
import re
|
||||
import click
|
||||
|
||||
|
||||
@click.command()
|
||||
@click.option("--exclude", multiple=True, default=[])
|
||||
@click.argument("arguments", nargs=-1)
|
||||
def main(exclude, arguments):
|
||||
# build command
|
||||
find_cmd = ["git", "annex", "find", "--include", "*", "--format=${key}:${file}\n", *arguments]
|
||||
for e in exclude:
|
||||
find_cmd += ["--exclude", e]
|
||||
|
||||
# run
|
||||
result = subprocess.run(find_cmd, capture_output=True)
|
||||
|
||||
files = collections.defaultdict(list)
|
||||
for l in result.stdout.decode("utf-8").split("\n"):
|
||||
if l == "":
|
||||
continue
|
||||
key, file = l.split(":", maxsplit=1)
|
||||
|
||||
files[key].append(file)
|
||||
|
||||
for k in files:
|
||||
if len(files[k]) > 1:
|
||||
for f in files[k]:
|
||||
print(f)
|
||||
print()
|
||||
Loading…
Add table
Add a link
Reference in a new issue