Skip to content

Commit

Permalink
added test
Browse files Browse the repository at this point in the history
  • Loading branch information
rsteube committed Dec 28, 2024
1 parent 004ecc8 commit 8b24938
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions example/cmd/_test/cmd-clink.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
local function example_completion(word, word_index, line_state, match_builder)
args = { "example", "_carapace", "fish", "\"\"" }
for i = 2,word_index,1 do
table.insert(args, line_state:getword(i))
end
-- table.insert(args, word)

output = io.popen(table.concat(args, " ")):read("*a")
for line in string.gmatch(output, '[^\r\n]+') do
-- match_builder:addmatch(line)
match_builder:addmatch(string.gsub(line, '\t.*', ""))
end

return true
end

clink.argmatcher("example"):addarg({example_completion}):loop(1)

0 comments on commit 8b24938

Please sign in to comment.