Skip to content

Instantly share code, notes, and snippets.

@tbnorth
Created June 14, 2022 13:04
Show Gist options
  • Save tbnorth/2f995890b0c86297890c3d42a4ab9d8c to your computer and use it in GitHub Desktop.
Save tbnorth/2f995890b0c86297890c3d42a4ab9d8c to your computer and use it in GitHub Desktop.
Update tags file based on paths in tags file
#!/usr/bin/env python
"""Scans file to find folders on which ctags was originally run."""
import subprocess
from pathlib import Path
dirs = set()
for line in Path("tags").open():
if line.startswith("!"):
continue
# extract 'tests' from
# turn_error_on tests/data/query_engine.py ...
dirs.add(line.split()[1].split("/")[0])
subprocess.run(["wc", "-l", "tags"])
cmd = ["ctags", "-R"] + list(dirs)
print(cmd)
subprocess.run(cmd)
subprocess.run(["wc", "-l", "tags"])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment