# @generated by usage-cli from usage spec

# if "usage" is not installed show an error
if ! type -P usage &> /dev/null
    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
end
set -l spec_dir (if set -q XDG_CACHE_HOME; echo $XDG_CACHE_HOME; else; echo $HOME/.cache; end)/usage
test -d "$spec_dir"; or mkdir -p -m 700 "$spec_dir"
set -l spec_file "$spec_dir/usage__usage_spec_mise_2026_8_10.spec"
if not test -f "$spec_file"
    find "$spec_dir" -maxdepth 1 -name 'usage__usage_spec_mise_*.spec' -type f -mtime +30 -delete 2>/dev/null
    mise usage | string collect > "$spec_file"
end

set -l tokens
if commandline -x >/dev/null 2>&1
    complete -xc mise -a "(command usage complete-word --shell fish -f \"$spec_file\" -- (commandline -xpc) (commandline -t))"
else
    complete -xc mise -a "(command usage complete-word --shell fish -f \"$spec_file\" -- (commandline -opc) (commandline -t))"
end
