feat(install): symlink myclaude to ~/.local/bin, make uninstall, docs
- Makefile: uv sync or venv pip install -e, then ln -sf to ~/.local/bin/myclaude - Add scripts/rm_user_local_myclaude.py for safe unlink on make uninstall - README: install path, shell completion guarded by command -v - Track uv.lock for reproducible uv sync Made-with: Cursor
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Remove ~/.local/bin/myclaude if it is a symlink to this repo's .venv/bin/myclaude."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
||||
def main() -> int:
|
||||
root = os.path.normpath(os.environ.get("ROOT_DIR", os.getcwd()))
|
||||
link = os.path.expanduser("~/.local/bin/myclaude")
|
||||
want = os.path.normpath(os.path.join(root, ".venv", "bin", "myclaude"))
|
||||
|
||||
if not os.path.islink(link):
|
||||
if os.path.lexists(link):
|
||||
print("Skip: not a symlink, leaving untouched")
|
||||
else:
|
||||
print("Nothing to remove")
|
||||
return 0
|
||||
|
||||
target = os.readlink(link)
|
||||
if not os.path.isabs(target):
|
||||
target = os.path.join(os.path.dirname(link), target)
|
||||
target = os.path.normpath(target)
|
||||
|
||||
if target == want:
|
||||
os.unlink(link)
|
||||
print("Removed", link)
|
||||
return 0
|
||||
|
||||
print("Skip: points to", target, "(not this repo's", want + ")")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
Reference in New Issue
Block a user