From fcd72e548ef9416c01756c04014a15ebe6a108b4 Mon Sep 17 00:00:00 2001 From: sibber5 Date: Fri, 12 Jun 2026 16:44:06 +0300 Subject: [PATCH 1/2] Fix outdated Nushell completion script --- .../shells/NuShellShellProvider.cs | 33 ++++++++----------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/src/System.CommandLine.StaticCompletions/shells/NuShellShellProvider.cs b/src/System.CommandLine.StaticCompletions/shells/NuShellShellProvider.cs index 211da99723e8..e4b1486507e7 100644 --- a/src/System.CommandLine.StaticCompletions/shells/NuShellShellProvider.cs +++ b/src/System.CommandLine.StaticCompletions/shells/NuShellShellProvider.cs @@ -20,29 +20,22 @@ public class NushellShellProvider : IShellProvider """ # Add the following content to your config.nu file: - let external_completer = { |spans| - { - dotnet: { || - dotnet complete ( - $spans | skip 1 | str join " " - ) | lines - } - } | get $spans.0 | each { || do $in } + let dotnet_completer = {|spans| + dotnet complete ($spans | str join " ") | lines } - # And then in the config record, find the completions section and add the - # external_completer that was defined earlier to external: - - let-env config = { - # your options here - completions: { - # your options here - external: { - # your options here - completer: $external_completer # add it here - } - } + # If you are using other completers, add the dotnet completer. Otherwise, just set external.completer to $dotnet_completer. + # (see https://nushell.sh/cookbook/external_completers.html#multiple-completer for more info) + let multiple_completers = {|spans| + match $spans.0 { + # Add the dotnet completer + "dotnet" => $dotnet_completer + # your other completers... + } | do $in $spans } + + $env.config.completions.external.enable = true + $env.config.completions.external.completer = $multiple_completers """; public string GenerateCompletions(System.CommandLine.Command command) => _dynamicCompletionScript; From 37dc4d51c35f64dd351a979b19f3740da7f4fc4c Mon Sep 17 00:00:00 2001 From: sibber5 Date: Fri, 12 Jun 2026 17:00:20 +0300 Subject: [PATCH 2/2] Update Nushell completion script --- .../shells/NuShellShellProvider.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/System.CommandLine.StaticCompletions/shells/NuShellShellProvider.cs b/src/System.CommandLine.StaticCompletions/shells/NuShellShellProvider.cs index e4b1486507e7..07856abd22a1 100644 --- a/src/System.CommandLine.StaticCompletions/shells/NuShellShellProvider.cs +++ b/src/System.CommandLine.StaticCompletions/shells/NuShellShellProvider.cs @@ -24,13 +24,13 @@ public class NushellShellProvider : IShellProvider dotnet complete ($spans | str join " ") | lines } - # If you are using other completers, add the dotnet completer. Otherwise, just set external.completer to $dotnet_completer. + # Add the dotnet completer. # (see https://nushell.sh/cookbook/external_completers.html#multiple-completer for more info) let multiple_completers = {|spans| match $spans.0 { # Add the dotnet completer "dotnet" => $dotnet_completer - # your other completers... + _ => { [] } # Fallback to empty list, or a completer such as $carapace_completer from the example in the nushell docs. } | do $in $spans }