From 2b4105b093ee86c4f796fa16bd6e6602e9f86054 Mon Sep 17 00:00:00 2001 From: qodelicious <162776175+qodelicious@users.noreply.github.com> Date: Mon, 19 Oct 2026 11:03:37 +0000 Subject: [PATCH] Don't list git subcommands twice in completions Subcommands with their own extern were showing up twice when completing git , once from the extern and once from git help -a. Leave those out of the git command completion. Aliases and commands without an extern still complete. --- custom-completions/git/git-completions.nu | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/custom-completions/git/git-completions.nu b/custom-completions/git/git-completions.nu index d626a02f..8342e043 100644 --- a/custom-completions/git/git-completions.nu +++ b/custom-completions/git/git-completions.nu @@ -314,6 +314,13 @@ def "nu-complete git subcommands" [] { | uniq-by value } +# Like the above, but leaves out subcommands that already have their own extern +# so they don't show up twice when completing `git ` +def "nu-complete git subcommands without externs" [] { + let externs = scope commands | where name starts-with "git " | get name | str substring 4.. + nu-complete git subcommands | where value not-in $externs +} + def "nu-complete git add" [] { nu-complete git files } @@ -1084,7 +1091,7 @@ export extern "git grep" [ ] export extern "git" [ - command?: string@"nu-complete git subcommands" # Subcommands + command?: string@"nu-complete git subcommands without externs" # Subcommands --version(-v) # Prints the Git suite version that the git program came from --help(-h) # Prints the synopsis and a list of the most commonly used commands --html-path # Print the path, without trailing slash, where Git’s HTML documentation is installed and exit