feat: XDG Base Directory compliance, --uninstall flag, and xclip advisory #13
Reference in New Issue
Block a user
Delete Branch "feat/xdg-compliance-and-uninstall"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
$XDG_CONFIG_HOME,$XDG_DATA_HOME, and$XDG_RUNTIME_DIRwith the conventional defaults (~/.config,~/.local/share,/tmp) as fallbacks.BIN_DIRstays~/.local/binsince no XDG standard covers user binaries.--uninstallflag — removes the binary symlink,.desktopentry, and data directory with colored per-step output and a post-run verification pass. Prompts to remove the config directory when stdin is a TTY; skips the prompt (keeps config) in non-interactive mode.--check-depsand--installnow emit a yellow warning whenwl-clipboardis absent butxclipis found, explaining that xclip routes through XWayland and may be unreliable on Wayland.wl-clipboard,xclip) consistently.tilde_pathhelper that replaces the$HOMEprefix with~/in any user-facing path string. Applied throughout--help,--install, and--uninstalloutput. Paths outside$HOME(e.g. custom XDG roots) are shown as full absolute paths. All actual file operations continue to use the original absolute paths.--uninstall.XDG_CONFIG_HOME/XDG_DATA_HOMEin the sandbox so the overriddenHOMEis respected (fixes a pre-existing test regression); addcpandlnto mocked tools; add test 15 (install verifies XDG file placement) and test 16 (uninstall verifies cleanup with config kept).Manual Verification
color-tool --helpand confirm--uninstallappears, the--installline shows~/...paths, and the config path at the bottom shows~/.config/color-tool/config.toml.$XDG_CONFIG_HOMEand$XDG_DATA_HOMEunset, run--installand confirm all output paths are shown as~/...and files land in the correct locations.XDG_DATA_HOME=/tmp/test-data XDG_CONFIG_HOME=/tmp/test-cfg, run--install, and confirm output shows the full/tmp/...paths (not~/...) and files land under those custom locations.--uninstall(after installing) and confirm all step output and the verification table show~/...paths. Answer N at the config prompt and confirm the config directory is kept.--uninstallagain and confirm it exits cleanly, reporting each missing item as "not found — skipping".--check-depson a system wherexclipis installed butwl-clipboardis not, and confirm the yellow└─ xclip found but wl-clipboard is missingadvisory appears../tests/run_tests.shand confirm all 16 tests pass.9ff6a58814to06dd84d3a3