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
+21 -22
View File
@@ -1,32 +1,31 @@
#!/bin/bash
# 安装 gvm(Go 版本管理)并配置 fish 与默认 Go 版本
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# shellcheck disable=SC1091
source "$SCRIPT_DIR/common/help.sh"
usage() {
cat <<'EOF'
用法: gvm-install
1. 安装 gvm
2. 为 fish 安装 fish-gvm、bass 插件
3. 安装并设置 go1.24.0 为默认版本
选项:
-h, --help 显示此帮助
EOF
}
dotfile_help_requested "${1:-}" && dotfile_show_help
set -e
# install gvm
bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)
# install gvm on fish
fish -c "fisher install JGAntunes/fish-gvm"
fish -c "fisher install edc/bass"
# install go
fish -c "gvm install go1.24.0 -B"
fish -c "gvm use go1.24.0 --default"
# # install neovim
# os_arch=$(uname -s)-$(uname -m)
# case $os_arch in
# "Darwin-x86_64")
# cd /usr/local
# wget https://golang.google.cn/dl/go1.23.2.linux-amd64.tar.gz
# tar zxvf go1.23.2.linux-amd64.tar.gz
# ;;
# "Linux-x86_64"|"Linux-arm64")
# cd /tmp
# rm -rf nvim-linux64.tar.gz
# wget https://go.dev/dl/go1.23.2.linux-amd64.tar.gz
# tar zxvf go1.23.2.linux-amd64.tar.gz
# mv go /usr/local/
# sudo ln -s /usr/local/go/bin/go/usr/local/bin/go
# ;;
# esac