Last active
October 16, 2021 04:49
-
-
Save ammgws/a574f9820e906d05be5d0dfa33106220 to your computer and use it in GitHub Desktop.
Find unused functions etc used in fish shell's PO files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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