Skip to content
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
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_spec_mise_2025_7_5:-}" ]] || _cache_invalid _usage_spec_mise_2025_7_5 ) \
&& ! _retrieve_cache _usage_spec_mise_2025_7_5;
if ( [[ -z "${_usage_spec_mise_2025_7_7:-}" ]] || _cache_invalid _usage_spec_mise_2025_7_7 ) \
&& ! _retrieve_cache _usage_spec_mise_2025_7_7;
then
spec="$(mise usage)"
_store_cache _usage_spec_mise_2025_7_5 spec
_store_cache _usage_spec_mise_2025_7_7 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,14 +6,14 @@ _mise() {
return 1
fi

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

local cur prev words cword was_split comp_args
_comp_initialize -n : -- "$@" || return
# shellcheck disable=SC2207
_comp_compgen -- -W "$(usage complete-word --shell bash -s "${_usage_spec_mise_2025_7_5}" --cword="$cword" -- "${words[@]}")"
_comp_compgen -- -W "$(usage complete-word --shell bash -s "${_usage_spec_mise_2025_7_7}" --cword="$cword" -- "${words[@]}")"
_comp_ltrim_colon_completions "$cur"
# shellcheck disable=SC2181
if [[ $? -ne 0 ]]; then
Expand Down
8 changes: 4 additions & 4 deletions completions/mise.fish
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ if ! command -v usage &> /dev/null
return 1
end

if ! set -q _usage_spec_mise_2025_7_5
set -g _usage_spec_mise_2025_7_5 (mise usage | string collect)
if ! set -q _usage_spec_mise_2025_7_7
set -g _usage_spec_mise_2025_7_7 (mise usage | string collect)
end
set -l tokens
if commandline -x >/dev/null 2>&1
complete -xc mise -a '(usage complete-word --shell fish -s "$_usage_spec_mise_2025_7_5" -- (commandline -xpc) (commandline -t))'
complete -xc mise -a '(usage complete-word --shell fish -s "$_usage_spec_mise_2025_7_7" -- (commandline -xpc) (commandline -t))'
else
complete -xc mise -a '(usage complete-word --shell fish -s "$_usage_spec_mise_2025_7_5" -- (commandline -opc) (commandline -t))'
complete -xc mise -a '(usage complete-word --shell fish -s "$_usage_spec_mise_2025_7_7" -- (commandline -opc) (commandline -t))'
end
8 changes: 5 additions & 3 deletions src/backend/platform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,16 @@ pub fn platform_aliases() -> Vec<(String, String)> {

/// Looks up a value in a BTreeMap using all possible platform key aliases.
/// Example: for key_type = "url", will check platform_macos_x64_url, platform_darwin_amd64_url, etc.
/// Also supports both "platforms_" and "platform_" prefixes.
pub fn lookup_platform_key<'a>(
opts: &'a BTreeMap<String, String>,
key_type: &str,
) -> Option<&'a String> {
for (os, arch) in platform_aliases() {
let key = format!("platform_{os}_{arch}_{key_type}");
if let Some(val) = opts.get(&key) {
return Some(val);
for prefix in ["platforms", "platform"] {

Copilot AI Jul 13, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider extracting the prefix array into a named constant (e.g., const PREFIXES: [&str; 2] = ["platforms", "platform"];) to improve readability and avoid repeated literals.

Suggested change
for prefix in ["platforms", "platform"] {
for prefix in PREFIXES {

Copilot uses AI. Check for mistakes.
if let Some(val) = opts.get(&format!("{prefix}_{os}_{arch}_{key_type}")) {
return Some(val);
}
}
}
None
Expand Down
Loading