diff --git a/Cargo.lock b/Cargo.lock index 963a317939..c8539327c6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -501,9 +501,9 @@ dependencies = [ [[package]] name = "aws-sdk-s3" -version = "1.119.0" +version = "1.120.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d65fddc3844f902dfe1864acb8494db5f9342015ee3ab7890270d36fbd2e01c" +checksum = "06673901e961f20fa8d7da907da48f7ad6c1b383e3726c22bd418900f015abe1" dependencies = [ "aws-credential-types", "aws-runtime", @@ -513,6 +513,7 @@ dependencies = [ "aws-smithy-eventstream", "aws-smithy-http", "aws-smithy-json", + "aws-smithy-observability", "aws-smithy-runtime", "aws-smithy-runtime-api", "aws-smithy-types", @@ -593,9 +594,9 @@ dependencies = [ [[package]] name = "aws-smithy-checksums" -version = "0.63.12" +version = "0.63.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87294a084b43d649d967efe58aa1f9e0adc260e13a6938eb904c0ae9b45824ae" +checksum = "23374b9170cbbcc6f5df8dc5ebb9b6c5c28a3c8f599f0e8b8b10eb6f4a5c6e74" dependencies = [ "aws-smithy-http", "aws-smithy-types", @@ -885,7 +886,7 @@ dependencies = [ "bitflags", "cexpr", "clang-sys", - "itertools 0.13.0", + "itertools 0.10.5", "log", "prettyplease", "proc-macro2", @@ -1339,7 +1340,7 @@ version = "3.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "faf9468729b8cbcea668e36183cb69d317348c2e08e994829fb56ebfdfbaac34" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -1555,15 +1556,14 @@ checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" [[package]] name = "crc-fast" -version = "1.6.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ddc2d09feefeee8bd78101665bd8645637828fa9317f9f292496dbbd8c65ff3" +checksum = "2fd92aca2c6001b1bf5ba0ff84ee74ec8501b52bbef0cac80bf25a6c1d87a83d" dependencies = [ "crc", "digest", - "rand 0.9.2", - "regex", "rustversion", + "spin 0.10.0", ] [[package]] @@ -2023,7 +2023,7 @@ dependencies = [ "libc", "option-ext", "redox_users", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -2259,7 +2259,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -2342,13 +2342,14 @@ checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" [[package]] name = "filetime" -version = "0.2.27" +version = "0.2.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f98844151eee8917efc50bd9e8318cb963ae8b297431495d3f758616ea5c57db" +checksum = "bc0505cd1b6fa6580283f6bdf70a73fcf4aba1184038c90902b92b3dd0df63ed" dependencies = [ "cfg-if", "libc", "libredox", + "windows-sys 0.60.2", ] [[package]] @@ -3691,8 +3692,6 @@ version = "0.15.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" dependencies = [ - "allocator-api2", - "equivalent", "foldhash 0.1.5", ] @@ -3970,7 +3969,7 @@ dependencies = [ "libc", "percent-encoding", "pin-project-lite", - "socket2 0.6.1", + "socket2 0.5.10", "system-configuration", "tokio", "tower-service", @@ -4416,7 +4415,7 @@ dependencies = [ "portable-atomic", "portable-atomic-util", "serde_core", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -4525,7 +4524,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "642883fdc81cf2da15ee8183fa1d2c7da452414dd41541a0f3e1428069345447" dependencies = [ "scopeguard", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -4592,7 +4591,7 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" dependencies = [ - "spin", + "spin 0.9.8", ] [[package]] @@ -4789,11 +4788,11 @@ dependencies = [ [[package]] name = "lru" -version = "0.12.5" +version = "0.16.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "234cf4f4a04dc1f57e24b96cc0cd600cf2af460d4161ac5ecdd0af8e1f3b2a38" +checksum = "a1dc47f592c06f33f8e3aea9591776ec7c9f9e4124778ff8a3c3b87159f7e593" dependencies = [ - "hashbrown 0.15.5", + "hashbrown 0.16.1", ] [[package]] @@ -4842,14 +4841,20 @@ dependencies = [ [[package]] name = "lzma-rust2" -version = "0.15.7" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1670343e58806300d87950e3401e820b519b9384281bbabfb15e3636689ffd69" +checksum = "c60a23ffb90d527e23192f1246b14746e2f7f071cb84476dd879071696c18a4a" dependencies = [ "crc", "sha2", ] +[[package]] +name = "lzma-rust2" +version = "0.15.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1670343e58806300d87950e3401e820b519b9384281bbabfb15e3636689ffd69" + [[package]] name = "lzma-sys" version = "0.1.20" @@ -5262,7 +5267,7 @@ version = "0.50.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -5624,7 +5629,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7d8fae84b431384b68627d0f9b3b1245fcf9f46f6c0e3dc902e9dce64edd1967" dependencies = [ "libc", - "windows-sys 0.61.2", + "windows-sys 0.45.0", ] [[package]] @@ -6143,7 +6148,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be769465445e8c1474e9c5dac2018218498557af32d9ed057325ec9a41ae81bf" dependencies = [ "heck", - "itertools 0.14.0", + "itertools 0.10.5", "log", "multimap", "once_cell", @@ -6163,7 +6168,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a56d757972c98b346a9b766e3f02746cde6dd1cd1d1d563472929fdd74bec4d" dependencies = [ "anyhow", - "itertools 0.14.0", + "itertools 0.10.5", "proc-macro2", "quote", "syn 2.0.114", @@ -6258,7 +6263,7 @@ dependencies = [ "quinn-udp", "rustc-hash 2.1.1", "rustls 0.23.36", - "socket2 0.6.1", + "socket2 0.5.10", "thiserror 2.0.18", "tokio", "tracing", @@ -6296,9 +6301,9 @@ dependencies = [ "cfg_aliases", "libc", "once_cell", - "socket2 0.6.1", + "socket2 0.5.10", "tracing", - "windows-sys 0.60.2", + "windows-sys 0.59.0", ] [[package]] @@ -6545,8 +6550,6 @@ dependencies = [ "rustls 0.23.36", "rustls-pki-types", "rustls-platform-verifier", - "serde", - "serde_json", "sync_wrapper", "tokio", "tokio-native-tls", @@ -6787,7 +6790,7 @@ dependencies = [ "errno 0.3.14", "libc", "linux-raw-sys", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -6858,7 +6861,7 @@ dependencies = [ "security-framework 3.5.1", "security-framework-sys", "webpki-root-certs", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -7365,7 +7368,7 @@ checksum = "414256b6bb303a2a38ad800096664c3b332295c17b7ef0674bf0acf44284036c" dependencies = [ "crc32fast", "js-sys", - "lzma-rust2", + "lzma-rust2 0.15.7", "wasm-bindgen", ] @@ -7482,7 +7485,7 @@ version = "1.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" dependencies = [ - "errno 0.3.14", + "errno 0.2.8", "libc", ] @@ -7705,6 +7708,12 @@ version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +[[package]] +name = "spin" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5fe4ccb98d9c292d56fec89a5e07da7fc4cf0dc11e156b41793132775d3e591" + [[package]] name = "spki" version = "0.7.3" @@ -7901,7 +7910,7 @@ dependencies = [ "getrandom 0.3.4", "once_cell", "rustix", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -8946,7 +8955,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -9531,9 +9540,9 @@ checksum = "66fee0b777b0f5ac1c69bb06d361268faafa61cd4682ae064a171c16c433e9e4" [[package]] name = "xx" -version = "2.3.1" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2df0028c106b318c37108eaa6930ee85c73e0ad03e2d54dfe7fea44975c1259" +checksum = "704f7d8fce796d9206ab2f0a04a0c59c54394105b838b236d6687e8eef721440" dependencies = [ "bzip2 0.6.1", "duct 1.1.1", @@ -9545,13 +9554,13 @@ dependencies = [ "miette", "rand 0.9.2", "regex", - "reqwest 0.13.1", + "reqwest 0.12.28", "sha2", "tar", "thiserror 2.0.18", "tokio", "xz2", - "zip 7.1.0", + "zip 6.0.0", ] [[package]] @@ -9732,21 +9741,21 @@ dependencies = [ [[package]] name = "zip" -version = "7.1.0" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9013f1222db8a6d680f13a7ccdc60a781199cd09c2fa4eff58e728bb181757fc" +checksum = "eb2a05c7c36fde6c09b08576c9f7fb4cda705990f73b58fe011abf7dfb24168b" dependencies = [ "aes", + "arbitrary", "bzip2 0.6.1", "constant_time_eq 0.3.1", "crc32fast", "deflate64", "flate2", - "generic-array", "getrandom 0.3.4", "hmac", "indexmap 2.13.0", - "lzma-rust2", + "lzma-rust2 0.13.0", "memchr", "pbkdf2", "ppmd-rust", diff --git a/completions/mise.ps1 b/completions/mise.ps1 new file mode 100644 index 0000000000..325cc878b6 --- /dev/null +++ b/completions/mise.ps1 @@ -0,0 +1,40 @@ +# @generated by usage-cli from usage spec + +if (-not (Get-Command 'usage' -ErrorAction SilentlyContinue)) { + Write-Warning "Error: usage CLI not found. This is required for completions to work in mise." + Write-Warning "See https://usage.jdx.dev for more information." + return +} + +Register-ArgumentCompleter -Native -CommandName 'mise' -ScriptBlock { + param($wordToComplete, $commandAst, $cursorPosition) + + $tmpDir = if ($env:TEMP) { $env:TEMP } else { [System.IO.Path]::GetTempPath() } + $specFile = Join-Path $tmpDir "usage__usage_spec_mise_2026_1_4.kdl" + + if (-not (Test-Path $specFile)) { + mise usage | Out-File -FilePath $specFile -Encoding utf8 +} + + $words = $commandAst.CommandElements | ForEach-Object { $_.ToString() } + if ($words.Count -lt 1) { + $words = @('mise') + } + + $completions = & 'usage' complete-word --shell powershell -f "$specFile" -- @words $wordToComplete 2>$null + + if ($completions) { + $completions | ForEach-Object { + $parts = $_ -split "`t", 2 + $completion = $parts[0] + $description = if ($parts.Count -gt 1) { $parts[1] } else { '' } + + [System.Management.Automation.CompletionResult]::new( + $completion, + $completion, + 'ParameterValue', + $description + ) + } + } +} diff --git a/docs/cli/completion.md b/docs/cli/completion.md index eced21ccf1..12826aea01 100644 --- a/docs/cli/completion.md +++ b/docs/cli/completion.md @@ -16,6 +16,7 @@ Shell type to generate completions for - `bash` - `fish` +- `powershell` - `zsh` ## Flags @@ -33,4 +34,5 @@ Examples: mise completion bash --include-bash-completion-lib > ~/.local/share/bash-completion/completions/mise mise completion zsh > /usr/local/share/zsh/site-functions/_mise mise completion fish > ~/.config/fish/completions/mise.fish +mise completion powershell >> $PROFILE ``` diff --git a/docs/installing-mise.md b/docs/installing-mise.md index 6652b30e04..568642d841 100644 --- a/docs/installing-mise.md +++ b/docs/installing-mise.md @@ -347,7 +347,7 @@ this is not necessary. See [`MISE_FISH_AUTO_ACTIVATE=1`](/configuration#mise-fish-auto-activate-1) for more information. ::: -### Powershell +### PowerShell ::: warning See [about_Profiles](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_profiles) docs to find your actual profile location. diff --git a/docs/tasks/file-tasks.md b/docs/tasks/file-tasks.md index 7cc4f2504c..3c667d2178 100644 --- a/docs/tasks/file-tasks.md +++ b/docs/tasks/file-tasks.md @@ -86,10 +86,10 @@ console.log(`PATH, ${Deno.env.get("PATH")}`); ```powershell [powershell] #!/usr/bin/env pwsh -#MISE description="Hello, World in Powershell" +#MISE description="Hello, World in PowerShell" $current_directory = Get-Location -Write-Host "Hello from Powershell, current directory is $current_directory" +Write-Host "Hello from PowerShell, current directory is $current_directory" ``` ::: diff --git a/mise.usage.kdl b/mise.usage.kdl index ec016356be..39d35f13e7 100644 --- a/mise.usage.kdl +++ b/mise.usage.kdl @@ -155,10 +155,10 @@ cmd cache help="Manage the mise cache" { } cmd completion help="Generate shell completions" { alias complete completions hide=#true - after_long_help "Examples:\n\n $ mise completion bash --include-bash-completion-lib > ~/.local/share/bash-completion/completions/mise\n $ mise completion zsh > /usr/local/share/zsh/site-functions/_mise\n $ mise completion fish > ~/.config/fish/completions/mise.fish\n" + after_long_help "Examples:\n\n $ mise completion bash --include-bash-completion-lib > ~/.local/share/bash-completion/completions/mise\n $ mise completion zsh > /usr/local/share/zsh/site-functions/_mise\n $ mise completion fish > ~/.config/fish/completions/mise.fish\n $ mise completion powershell >> $PROFILE\n" flag "-s --shell" help="Shell type to generate completions for" hide=#true { arg { - choices bash fish zsh + choices bash fish powershell zsh } } flag --include-bash-completion-lib help="Include the bash completion library in the bash completion script" { @@ -168,7 +168,7 @@ cmd completion help="Generate shell completions" { long_help "Always use usage for completions.\nCurrently, usage is the default for fish and bash but not zsh since it has a few quirks\nto work out first.\n\nThis requires the `usage` CLI to be installed.\nhttps://usage.jdx.dev" } arg "[SHELL]" help="Shell type to generate completions for" required=#false { - choices bash fish zsh + choices bash fish powershell zsh } } cmd config help="Manage config files" { diff --git a/src/backend/conda_macos.rs b/src/backend/conda_macos.rs index 244a9be2f2..ed1436115a 100644 --- a/src/backend/conda_macos.rs +++ b/src/backend/conda_macos.rs @@ -98,12 +98,12 @@ fn find_paths_to_fix(deps: &str, lib_dir: &Path) -> Vec<(String, PathBuf)> { .skip(1) // Skip the first line (file path) .filter_map(|line| { let line = line.trim(); - if let Some(old_path) = extract_build_path(line) { - if let Some(lib_name) = Path::new(&old_path).file_name() { - let new_path = lib_dir.join(lib_name); - if new_path.exists() { - return Some((old_path, new_path)); - } + if let Some(old_path) = extract_build_path(line) + && let Some(lib_name) = Path::new(&old_path).file_name() + { + let new_path = lib_dir.join(lib_name); + if new_path.exists() { + return Some((old_path, new_path)); } } None @@ -117,13 +117,13 @@ fn verify_signature(path: &Path) { .args(["--verify", path.to_str().unwrap_or("")]) .output(); - if let Ok(output) = result { - if !output.status.success() { - debug!( - "Binary {} has invalid or missing signature, skipping signature verification", - path.display() - ); - } + if let Ok(output) = result + && !output.status.success() + { + debug!( + "Binary {} has invalid or missing signature, skipping signature verification", + path.display() + ); } } diff --git a/src/cli/completion.rs b/src/cli/completion.rs index b447013891..228e332125 100644 --- a/src/cli/completion.rs +++ b/src/cli/completion.rs @@ -78,6 +78,7 @@ impl Completion { match shell { Shell::Bash => include_str!("../../completions/mise.bash"), Shell::Fish => include_str!("../../completions/mise.fish"), + Shell::PowerShell => include_str!("../../completions/mise.ps1"), Shell::Zsh => include_str!("../../completions/_mise"), } .to_string() @@ -90,20 +91,24 @@ static AFTER_LONG_HELP: &str = color_print::cstr!( $ mise completion bash --include-bash-completion-lib > ~/.local/share/bash-completion/completions/mise $ mise completion zsh > /usr/local/share/zsh/site-functions/_mise $ mise completion fish > ~/.config/fish/completions/mise.fish + $ mise completion powershell >> $PROFILE "# ); #[derive(Debug, Clone, Copy, EnumString, strum::Display)] #[strum(serialize_all = "snake_case")] +#[allow(clippy::enum_variant_names)] // PowerShell is a proper noun enum Shell { Bash, Fish, + #[strum(serialize = "powershell")] + PowerShell, Zsh, } impl ValueEnum for Shell { fn value_variants<'a>() -> &'a [Self] { - &[Self::Bash, Self::Fish, Self::Zsh] + &[Self::Bash, Self::Fish, Self::PowerShell, Self::Zsh] } fn to_possible_value(&self) -> Option { Some(PossibleValue::new(self.to_string())) diff --git a/src/cli/watch.rs b/src/cli/watch.rs index 9a4f4151b3..07fa88e155 100644 --- a/src/cli/watch.rs +++ b/src/cli/watch.rs @@ -1177,12 +1177,13 @@ pub enum FsEvent { } #[derive(Clone, Copy, Debug, Eq, PartialEq, ValueEnum)] +#[clap(rename_all = "lower")] pub enum ShellCompletion { Bash, Elvish, Fish, Nu, - Powershell, + PowerShell, Zsh, } diff --git a/tasks.toml b/tasks.toml index 8c4a6ee2b1..aece3523a2 100644 --- a/tasks.toml +++ b/tasks.toml @@ -91,6 +91,7 @@ set -xeuo pipefail mise completion bash > completions/mise.bash mise completion zsh > completions/_mise mise completion fish > completions/mise.fish +mise completion powershell > completions/mise.ps1 ''' ["render:mangen"] diff --git a/xtasks/fig/src/mise.ts b/xtasks/fig/src/mise.ts index 1e2ed8799d..511d91d793 100644 --- a/xtasks/fig/src/mise.ts +++ b/xtasks/fig/src/mise.ts @@ -736,7 +736,7 @@ const completionSpec: Fig.Spec = { name: "shell", description: "Shell type to generate completions for", isOptional: true, - suggestions: ["bash", "fish", "zsh"], + suggestions: ["bash", "fish", "powershell", "zsh"], }, }, {