dot: 重构 bashrc.d 目录结构,调整版本(包)管理器脚本加载顺序

- 将 mise、rust 等管理器脚本移入 manager/ 子目录,与工具脚本区分
- mise/volta 的补全改到各自 activate 函数内延迟生成,避免未激活时执行
- 新增 uv/uvx 的 bash 补全
- .bashrc 拆分为先加载 manager/ 再加载顶层脚本的两段流程
- .xprofile 改用 bash 解释并复用相同的脚本加载流程
This commit is contained in:
2026-07-11 02:20:11 +08:00
parent 1a6fa5c1a3
commit 77509f565a
6 changed files with 44 additions and 19 deletions

View File

@@ -1,15 +1,14 @@
basedir=$(realpath -m $(dirname "${BASH_SOURCE[0]:-$0}"))
source "${basedir}/function.bash"
source "${basedir}/../function.bash"
unset basedir
if [[ -x $(type -p mise) ]]; then
completion_cmd="mise completion --include-bash-completion-lib bash"
generate-bash-completion mise "$completion_cmd"
unset completion_cmd
mise-activate() {
eval "$(mise activate bash)"
local completion_cmd="mise completion --include-bash-completion-lib bash"
generate-bash-completion mise "$completion_cmd"
}
mise-deactivate() {

View File

@@ -1,5 +1,5 @@
basedir=$(realpath -m $(dirname "${BASH_SOURCE[0]:-$0}"))
source "${basedir}/function.bash"
source "${basedir}/../function.bash"
unset basedir

12
dot/.bashrc.d/uv.bash Normal file
View File

@@ -0,0 +1,12 @@
basedir=$(realpath -m $(dirname "${BASH_SOURCE[0]:-$0}"))
source "${basedir}/function.bash"
unset basedir
if [[ -x "$(type -p uv)" ]]; then
generate-bash-completion uv "uv generate-shell-completion bash"
fi
if [[ -x "$(type -p uvx)" ]]; then
generate-bash-completion uvx "uvx --generate-shell-completion bash"
fi

View File

@@ -6,10 +6,9 @@ unset basedir
export VOLTA_HOME="${HOME}/.volta"
if [[ -x $(type -p volta) || -x "${VOLTA_HOME}/bin/volta" ]]; then
generate-bash-completion volta "volta completions bash"
volta-activate() {
add-to-path "${VOLTA_HOME}/bin"
generate-bash-completion volta "volta completions bash"
# enable pnpm support
# export VOLTA_FEATURE_PNPM=1