-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Expand file tree
/
Copy path_mise
More file actions
48 lines (42 loc) · 1.25 KB
/
Copy path_mise
File metadata and controls
48 lines (42 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#compdef mise
# @generated by usage-cli from usage spec
local curcontext="$curcontext"
# caching config
_usage_mise_cache_policy() {
if [[ -z "${lifetime}" ]]; then
lifetime=$((60*60*4)) # 4 hours
fi
local -a oldp
oldp=( "$1"(Nms+${lifetime}) )
(( $#oldp ))
}
_mise() {
typeset -A opt_args
local curcontext="$curcontext" cache_policy
if ! type -p usage &> /dev/null; then
echo >&2
echo "Error: usage CLI not found. This is required for completions to work in mise." >&2
echo "See https://usage.jdx.dev for more information." >&2
return 1
fi
local spec_file="${TMPDIR:-/tmp}/usage__usage_spec_mise_2026_5_18.spec"
if [[ ! -f "$spec_file" ]]; then
mise usage >| "$spec_file"
fi
local -a completions=() inserts=()
local needs_menu=0 display insert
while IFS=$'\t' read -r display insert; do
completions+=("$display")
inserts+=("$insert")
[[ "$insert" == "'"* ]] && needs_menu=1
done < <(command usage complete-word --shell zsh -f "$spec_file" -- "${(Q)words[@]}")
(( needs_menu )) && compstate[insert]=menu
_describe 'completions' completions inserts -U -Q -S ''
return 0
}
if [ "$funcstack[1]" = "_mise" ]; then
_mise "$@"
else
compdef _mise mise
fi
# vim: noet ci pi sts=0 sw=4 ts=4