2024-01-03 13:02:43 +01:00
|
|
|
# TODO: 2024-01-03 remove rtx support
|
|
|
|
local __mise=mise
|
|
|
|
if (( ! $+commands[mise] )); then
|
|
|
|
if (( $+commands[rtx] )); then
|
|
|
|
__mise=rtx
|
|
|
|
else
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Load mise hooks
|
|
|
|
eval "$($__mise activate zsh)"
|
|
|
|
|
2024-03-21 20:46:40 +01:00
|
|
|
# Hook mise into current environment
|
|
|
|
eval "$($__mise hook-env -s zsh)"
|
|
|
|
|
2024-01-03 13:02:43 +01:00
|
|
|
# If the completion file doesn't exist yet, we need to autoload it and
|
|
|
|
# bind it to `mise`. Otherwise, compinit will have already done that.
|
|
|
|
if [[ ! -f "$ZSH_CACHE_DIR/completions/_$__mise" ]]; then
|
|
|
|
typeset -g -A _comps
|
|
|
|
autoload -Uz _$__mise
|
|
|
|
_comps[$__mise]=_$__mise
|
|
|
|
fi
|
|
|
|
|
2024-10-28 02:59:52 +01:00
|
|
|
|
|
|
|
if [[ "$ZSH_MISE_AUTOEXPORT_VERSIONS" != true ]]; then
|
|
|
|
_updateMiseVersions() {
|
|
|
|
unset -m "MISE_TOOL_*"
|
|
|
|
eval $(mise ls -c --no-header \
|
|
|
|
| sed 's/^\(\S\+\)\s\+\(\S\+\).*$/export MISE_TOOL_\U\1=\2/')
|
|
|
|
}
|
|
|
|
|
|
|
|
autoload -U add-zsh-hook
|
|
|
|
add-zsh-hook chpwd _updateMiseVersions
|
|
|
|
_updateMiseVersions # Initial call to check the current directory at shell startup
|
|
|
|
fi
|
|
|
|
|
2024-01-03 13:02:43 +01:00
|
|
|
# Generate and load mise completion
|
|
|
|
$__mise completion zsh >| "$ZSH_CACHE_DIR/completions/_$__mise" &|
|
2024-07-15 19:04:06 +02:00
|
|
|
unset __mise
|