2022-12-07 16:12:24 -06:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
|
|
import sys
|
|
|
|
from pathlib import Path
|
|
|
|
|
2023-01-03 13:19:40 -06:00
|
|
|
EXTS = ["otf", "ttf", "woff", "woff2"]
|
|
|
|
|
2022-12-07 16:12:24 -06:00
|
|
|
|
|
|
|
def find_files(search_path, exts=None):
|
|
|
|
return (
|
|
|
|
[f for ext in exts for f in search_path.glob(f"**/*.{ext}")]
|
|
|
|
if exts
|
|
|
|
else [f for f in search_path.rglob("*") if f.is_file()]
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
if len(sys.argv) == 1:
|
|
|
|
print("please specify directory to search")
|
|
|
|
exit(1)
|
|
|
|
|
|
|
|
search_path = Path(sys.argv[1])
|
2023-01-03 13:19:40 -06:00
|
|
|
exts = sys.argv[2].split(",") if len(sys.argv) == 3 else EXTS
|
2022-12-07 16:12:24 -06:00
|
|
|
|
|
|
|
for f in find_files(search_path, exts):
|
2022-12-13 00:12:00 -06:00
|
|
|
sys.stdout.write(f"-f '{f}' ")
|
2022-12-07 16:12:24 -06:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
main()
|