Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(completions): set usage cache-key #2937

Merged
merged 3 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions .mise.lock

This file was deleted.

2 changes: 1 addition & 1 deletion .mise.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ direnv = "latest"
actionlint = "latest"
ripgrep = "latest"
"pipx:toml-sort" = "latest"
"cargo:usage-cli" = "1"
"cargo:usage-cli" = "1.2"
#python = { version = "latest", virtualenv = "{{env.HOME}}/.cache/venv" }
#ruby = "3.1"

Expand Down
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions completions/_mise
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ _mise() {
zstyle ":completion:${curcontext}:" cache-policy _usage_mise_cache_policy
fi

if ( [[ -z "${_usage_mise_spec:-}" ]] || _cache_invalid _usage_mise_spec ) \
&& ! _retrieve_cache _usage_mise_spec;
if ( [[ -z "${_usage_spec_mise_2024_11_1:-}" ]] || _cache_invalid _usage_spec_mise_2024_11_1 ) \
&& ! _retrieve_cache _usage_spec_mise_2024_11_1;
then
spec="$(mise usage)"
_store_cache _usage_mise_spec spec
_store_cache _usage_spec_mise_2024_11_1 spec
fi

_arguments "*: :(($(usage complete-word --shell zsh -s "$spec" -- "${words[@]}" )))"
Expand Down
6 changes: 3 additions & 3 deletions completions/mise.bash
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ _mise() {
return 1
fi

if [[ -z ${_USAGE_SPEC_MISE:-} ]]; then
_USAGE_SPEC_MISE="$(mise usage)"
if [[ -z ${_usage_spec_mise_2024_11_1:-} ]]; then
_usage_spec_mise_2024_11_1="$(mise usage)"
fi

COMPREPLY=( $(usage complete-word --shell bash -s "${_USAGE_SPEC_MISE}" --cword="$COMP_CWORD" -- "${COMP_WORDS[@]}" ) )
COMPREPLY=( $(usage complete-word --shell bash -s "${_usage_spec_mise_2024_11_1}" --cword="$COMP_CWORD" -- "${COMP_WORDS[@]}" ) )
if [[ $? -ne 0 ]]; then
unset COMPREPLY
fi
Expand Down
6 changes: 4 additions & 2 deletions completions/mise.fish
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@ if ! command -v usage &> /dev/null
return 1
end

set _usage_spec_mise (mise usage | string collect)
complete -xc mise -a '(usage complete-word --shell fish -s "$_usage_spec_mise" -- (commandline -cop) (commandline -t))'
if ! set -q _usage_spec_mise_2024_11_1
set -U _usage_spec_mise_2024_11_1 (mise usage | string collect)
end
complete -xc mise -a '(usage complete-word --shell fish -s "$_usage_spec_mise_2024_11_1" -- (commandline -cop) (commandline -t))'
4 changes: 3 additions & 1 deletion src/cli/completion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ impl Completion {
shell.to_string(),
"mise",
"--usage-cmd",
"mise usage"
"mise usage",
"--cache-key",
env!("CARGO_PKG_VERSION")
)
.read()
}
Expand Down
Loading