Skip to content

Instantly share code, notes, and snippets.

@ammgws
Last active October 16, 2021 04:49
Show Gist options
  • Save ammgws/a574f9820e906d05be5d0dfa33106220 to your computer and use it in GitHub Desktop.
Save ammgws/a574f9820e906d05be5d0dfa33106220 to your computer and use it in GitHub Desktop.
Find unused functions etc used in fish shell's PO files
import re
from pathlib import Path
p = Path("/tmp/fish-shell/po/")
for pofile in list(p.glob('*.po')):
print(f"=============================\n{pofile}\n=============================")
with open(pofile) as f:
po_data = f.readlines()
del_these = set()
pattern = re.compile("#: \/tmp\/fish\/implicit\/share\/(.+):\d+")
for line in po_data:
if m := pattern.match(line):
testp = Path('/tmp/fish-shell/share') / m.group(1)
if not testp.exists():
del_these.add(str(testp))
del_these = list(del_these)
del_these.sort()
for x in del_these:
print(x)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment