amtoine / nu-git-manager

A collection of Nushell tools to manage Git repositories.
GNU General Public License v3.0
26 stars 2 forks source link

add a new `dotfiles` module to `sugar` with `gm cfg` commands #177

Closed amtoine closed 6 months ago

amtoine commented 7 months ago

this needs an addition in the external completer...

amtoine commented 6 months ago

i had to apply the following diff to my dotfiles to make the completions work with Carapace

diff --git a/.config/nushell/completion.nu b/.config/nushell/completion.nu
index 8261689..8b8f8ca 100644
--- a/.config/nushell/completion.nu
+++ b/.config/nushell/completion.nu
@@ -12,6 +12,12 @@ $env.config.completions.external.completer = {|tokens: list<string>|

     let tokens = if $expanded_alias != null  {
         $expanded_alias | split row " " | append ($tokens | skip 1)
+    } else if ($tokens.0 | str trim | str replace --all --regex '\s+' ' ') == "gm cfg" {
+        [
+            "git",
+            "--git-dir", $env.DOTFILES_GIT_DIR,
+            "--work-tree", $env.DOTFILES_WORKTREE
+        ] | append ($tokens | skip 1)
     } else {
         $tokens
     }

and it requires Carapace 0.30.1 which has been patched with https://github.com/rsteube/carapace-bin/pull/2210