Skip to content

Commit 49b6747

Browse files
authored
Merge pull request #1060 from carapace-sh/elvish-exe-completion
elvish: register `.exe` completion on windows
2 parents e76b528 + a0a6f1f commit 49b6747

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

internal/shell/elvish/snippet.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@ package elvish
33

44
import (
55
"fmt"
6+
"runtime"
67

78
"github.com/carapace-sh/carapace/pkg/uid"
89
"github.com/spf13/cobra"
910
)
1011

1112
// Snippet creates the elvish completion script.
1213
func Snippet(cmd *cobra.Command) string {
13-
return fmt.Sprintf(`set edit:completion:arg-completer[%v] = {|@arg|
14+
result := fmt.Sprintf(`set edit:completion:arg-completer[%v] = {|@arg|
1415
%v _carapace elvish (all $arg) | from-json | each {|completion|
1516
put $completion[Messages] | all (one) | each {|m|
1617
edit:notify (styled "error: " red)$m
@@ -28,4 +29,9 @@ func Snippet(cmd *cobra.Command) string {
2829
}
2930
}
3031
`, cmd.Name(), uid.Executable())
32+
33+
if runtime.GOOS == "windows" {
34+
result += fmt.Sprintf("set edit:completion:arg-completer[%v.exe] = $edit:completion:arg-completer[%v]\n", cmd.Name(), cmd.Name())
35+
}
36+
return result
3137
}

0 commit comments

Comments
 (0)