Skip to content

Commit 8d3aa25

Browse files
committed
add cleanup for dev
1 parent 410963e commit 8d3aa25

File tree

2 files changed

+43
-2
lines changed

2 files changed

+43
-2
lines changed

src/autocmd_cli/cleanup_autocmd.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import os
2+
import shutil
3+
from pathlib import Path
4+
5+
def cleanup():
6+
# 1. Remove config directory
7+
config_dir = Path.home() / ".config" / "autocmd"
8+
if config_dir.exists():
9+
print(f"Removing config dir: {config_dir}")
10+
shutil.rmtree(config_dir)
11+
else:
12+
print("Config dir not found.")
13+
14+
# 2. Clean .zshrc
15+
zshrc = Path.home() / ".zshrc"
16+
if zshrc.exists():
17+
lines = zshrc.read_text().splitlines()
18+
new_lines = []
19+
skip = False
20+
cleaned = False
21+
22+
for line in lines:
23+
# Identify blocks to remove
24+
if "# autocmd" in line or "alias autocmd-dev=" in line or "autocmd() {" in line:
25+
cleaned = True
26+
continue
27+
28+
# Also remove the logic inside the function if any lines slipped through
29+
# (The previous script was simple filtering, let's keep it simple)
30+
31+
new_lines.append(line)
32+
33+
if cleaned:
34+
print(f"Removing autocmd lines from {zshrc}")
35+
# Ensure we don't leave weird empty lines, but mostly fine
36+
zshrc.write_text('\n'.join(new_lines) + '\n')
37+
else:
38+
print("No autocmd lines found in .zshrc")
39+
40+
if __name__ == "__main__":
41+
cleanup()

uv.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)