diff --git a/cmd/carapace/cmd/lazyinit/elvish.go b/cmd/carapace/cmd/lazyinit/elvish.go index a84629c6a4..735934327a 100644 --- a/cmd/carapace/cmd/lazyinit/elvish.go +++ b/cmd/carapace/cmd/lazyinit/elvish.go @@ -2,10 +2,16 @@ package lazyinit import ( "fmt" + "runtime" "strings" ) func Elvish(completers []string) string { + windowsSnippet := "" + if runtime.GOOS == "windows" { + windowsSnippet = "\n set edit:completion:arg-completer[$c.exe] = $edit:completion:arg-completer[$c]\n" + } + snippet := `%v put %v | each {|c| @@ -13,8 +19,8 @@ put %v | each {|c| set edit:completion:arg-completer[$c] = {|@arg| } eval (carapace $c elvish | slurp) $edit:completion:arg-completer[$c] $@arg - } + }%v } ` - return fmt.Sprintf(snippet, pathSnippet("elvish"), strings.Join(completers, " ")) + return fmt.Sprintf(snippet, pathSnippet("elvish"), strings.Join(completers, " "), windowsSnippet) } diff --git a/go.mod b/go.mod index 33c4e399b6..a8ffc2d432 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/carapace-sh/carapace-bin go 1.23.1 require ( - github.com/carapace-sh/carapace v1.5.0 + github.com/carapace-sh/carapace v1.5.1 github.com/carapace-sh/carapace-bridge v1.2.2 github.com/carapace-sh/carapace-selfupdate v0.0.8 github.com/carapace-sh/carapace-shlex v1.0.1 diff --git a/go.sum b/go.sum index 311dede2fb..c40cf5b4e4 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -github.com/carapace-sh/carapace v1.5.0 h1:rjNMTo5sY3YybMKbzEuaM19HEG6JXhvCTOrioV0QUHY= -github.com/carapace-sh/carapace v1.5.0/go.mod h1:djegtVDi/3duSAqZNU+/nCq7XtDRMRZUb5bW0O/HnEs= +github.com/carapace-sh/carapace v1.5.1 h1:GEh7da7nQhxca4+RvjtLh63F/E1eyoEyz5iNS7xZHgY= +github.com/carapace-sh/carapace v1.5.1/go.mod h1:djegtVDi/3duSAqZNU+/nCq7XtDRMRZUb5bW0O/HnEs= github.com/carapace-sh/carapace-bridge v1.2.2 h1:Zlzw7BajF4iHAFBClCYcptEG+7+F324dFyiGzGiU/kw= github.com/carapace-sh/carapace-bridge v1.2.2/go.mod h1:HpN3iEdCmQtAD1pd/qHEnWmAF719CeNyJrY8FJ5/E4o= github.com/carapace-sh/carapace-pflag v1.0.0 h1:uJMhl+vwEM/Eb0UdxZUuv4jo4rUAyPijkRGP5gfCuCE=