diff --git a/go.mod b/go.mod index e97710b19..11cb928cc 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/internal/shell/cmd_clink/snippet.go b/internal/shell/cmd_clink/snippet.go index 67b949e42..195e157f2 100644 --- a/internal/shell/cmd_clink/snippet.go +++ b/internal/shell/cmd_clink/snippet.go @@ -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))) @@ -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 }