refactor(self-mgmt): centralize manual file list for install/uninstall
This commit is contained in:
@@ -2,6 +2,9 @@ ROOT_DIR := $(shell pwd)
|
||||
COMP_DIR := $(HOME)/.local/bin/completions
|
||||
PYTHON ?= python3
|
||||
|
||||
# 手动安装的文件清单(与 bin/commands/self_mgmt.py 中的 _MANUAL_FILES 保持同步)
|
||||
MANUAL_FILES := $(COMP_DIR)/_mytoolkit $(COMP_DIR)/mytoolkit.bash
|
||||
|
||||
.PHONY: help install uninstall
|
||||
|
||||
help:
|
||||
@@ -27,5 +30,10 @@ install:
|
||||
|
||||
uninstall:
|
||||
$(PYTHON) -m pip uninstall mytoolkit -y
|
||||
rm -f "$(COMP_DIR)/_mytoolkit" "$(COMP_DIR)/mytoolkit.bash"
|
||||
@echo "Uninstalled mytoolkit and removed completions"
|
||||
@for f in $(MANUAL_FILES); do \
|
||||
if [ -e "$$f" ] || [ -L "$$f" ]; then \
|
||||
rm -f "$$f"; \
|
||||
echo "Removed $$f"; \
|
||||
fi; \
|
||||
done
|
||||
@echo "Uninstalled mytoolkit and cleaned up manual files"
|
||||
|
||||
Reference in New Issue
Block a user