summaryrefslogtreecommitdiff
path: root/plugins/mise/mise.plugin.zsh
diff options
context:
space:
mode:
authorJared Allard <jaredallard@users.noreply.github.com>2024-01-03 04:02:43 -0800
committerGitHub <noreply@github.com>2024-01-03 13:02:43 +0100
commitb5583a321644218702c4ef588934575f46a2159b (patch)
tree1ee62c503c0d9949d9fc756fac593d63525bd559 /plugins/mise/mise.plugin.zsh
parenta9b6af5b231227f8ab91f922adc5e0d0a2e6fc08 (diff)
downloadzsh-b5583a321644218702c4ef588934575f46a2159b.tar.gz
zsh-b5583a321644218702c4ef588934575f46a2159b.tar.bz2
zsh-b5583a321644218702c4ef588934575f46a2159b.zip
fix(rtx)!: rename `rtx` plugin to `mise` (#12143)
BREAKING CHANGE: Rename `rtx` plugin to `mise`. The project swapped name in `v2024.1.0`. Replace references to `rtx` with `mise` while maintaining backwards compatibility for `rtx` installations. Co-authored-by: Carlo Sala <carlosalag@protonmail.com>
Diffstat (limited to 'plugins/mise/mise.plugin.zsh')
-rw-r--r--plugins/mise/mise.plugin.zsh23
1 files changed, 23 insertions, 0 deletions
diff --git a/plugins/mise/mise.plugin.zsh b/plugins/mise/mise.plugin.zsh
new file mode 100644
index 000000000..1b4d3ae81
--- /dev/null
+++ b/plugins/mise/mise.plugin.zsh
@@ -0,0 +1,23 @@
+# 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)"
+
+# 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
+
+# Generate and load mise completion
+$__mise completion zsh >| "$ZSH_CACHE_DIR/completions/_$__mise" &|