Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
rsteube committed Dec 28, 2024
1 parent 73f925f commit 1571bac
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/carapace-sh/carapace

go 1.15
go 1.16

require (
github.com/carapace-sh/carapace-shlex v1.0.1
Expand Down
6 changes: 4 additions & 2 deletions internal/shell/cmd_clink/snippet.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ import (
"fmt"

"github.com/carapace-sh/carapace/pkg/uid"
jsonlua "github.com/carapace-sh/carapace/third_party/github.com/rxi/json.lua"
"github.com/spf13/cobra"
)

func Snippet(cmd *cobra.Command) string {
result := fmt.Sprintf(`local function %v_completion(word, word_index, line_state, match_builder)
result := fmt.Sprintf(`%v
local function %v_completion(word, word_index, line_state, match_builder)
args = { %#v, "_carapace", "fish", "\"\"" }
for i = 2,word_index,1 do
table.insert(args, string.format("%%q" ,line_state:getword(i)))
Expand All @@ -25,6 +27,6 @@ func Snippet(cmd *cobra.Command) string {
end
clink.argmatcher("%v"):addarg({%v_completion}):loop(1)
`, cmd.Name(), uid.Executable(), cmd.Name(), cmd.Name())
`, jsonlua.Script, cmd.Name(), uid.Executable(), cmd.Name(), cmd.Name())
return result
}

0 comments on commit 1571bac

Please sign in to comment.