feat: add script catalog and -h help for all dotfile scripts

Introduce ff script -h with auto descriptions, shared help.sh, and usage flags across script/*.sh.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-25 15:09:35 +08:00
parent 1f6b042b26
commit 67291a9a50
36 changed files with 1056 additions and 442 deletions
+25 -4
View File
@@ -1,17 +1,38 @@
#!/bin/bash
# 将 Cursor 用户配置链接到 dotfile(macOS)
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# shellcheck disable=SC1091
source "$SCRIPT_DIR/common/help.sh"
usage() {
cat <<'EOF'
用法: cursor-init
链接 ~/.dotfile/cursor/config/ 下的 settings.json、keybindings.json
到 Cursor 用户目录(macOS)。
已有文件会备份为 *.bak。
选项:
-h, --help 显示此帮助
EOF
}
dotfile_help_requested "${1:-}" && dotfile_show_help
set -euo pipefail
echo 'Cursor config init'
# init settings.json
src="$HOME/Library/Application Support/Cursor/User/settings.json"
if [ -f "$src" ]; then
mv "$src" "$src.bak"
mv "$src" "$src.bak"
fi
ln -s "$HOME/.dotfile/cursor/config/settings.json" "$src"
# init keybindings.json
src="$HOME/Library/Application Support/Cursor/User/keybindings.json"
if [ -f "$src" ]; then
mv "$src" "$src.bak"
mv "$src" "$src.bak"
fi
ln -s "$HOME/.dotfile/cursor/config/keybindings.json" "$src"