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:
+27
-5
@@ -1,9 +1,31 @@
|
||||
#!/bin/bash
|
||||
# 安装 fnm(Node 版本管理)并 reload fish 配置
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
# shellcheck disable=SC1091
|
||||
source "$SCRIPT_DIR/common/help.sh"
|
||||
|
||||
usage() {
|
||||
cat <<'EOF'
|
||||
用法: nvm-install
|
||||
|
||||
通过 fnm 官方安装脚本安装 Fast Node Manager,并执行 ff reload。
|
||||
|
||||
选项:
|
||||
-h, --help 显示此帮助
|
||||
|
||||
说明: 本仓库 fish 配置中 nvm 别名指向 fnm。
|
||||
EOF
|
||||
}
|
||||
|
||||
dotfile_help_requested "${1:-}" && dotfile_show_help
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# https://github.com/Schniz/fnm
|
||||
curl -fsSL https://fnm.vercel.app/install | bash
|
||||
|
||||
ff reload
|
||||
|
||||
# after install node
|
||||
# corepack enable pnpm
|
||||
if command -v ff &>/dev/null; then
|
||||
ff reload
|
||||
elif command -v fish &>/dev/null; then
|
||||
fish -c "source ~/.config/fish/config.fish"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user