Skip to content

Commit

Permalink
Add completions for where.
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisant996 committed Sep 5, 2024
1 parent 3192df1 commit 0f83747
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions completions/where.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
require('arghelper')

local dir_matcher = clink.argmatcher():addarg(clink.dirmatches)

-- luacheck: push
-- luacheck: no max line length
local flag_def_table = {
{"/r", dir_matcher, " dir", "Recursively searches and displays the files that match the given pattern starting from the specified directory"},
{"/q", "Returns only the exit code, without displaying the list of matched files. (Quiet mode)"},
{"/f", "Displays the matched filename in double quotes"},
{"/t", "Displays the file size, last modified date and time for all matched files"},
{"/?", "Displays help message"},
}
-- luacheck: pop

local flags = {}
for _,f in ipairs(flag_def_table) do
if f[3] then
table.insert(flags, { f[1]..f[2], f[3], f[4] })
if f[1]:upper() ~= f[1] then
table.insert(flags, { hide=true, f[1]:upper()..f[2], f[3], f[4] })
end
else
table.insert(flags, { f[1], f[2] })
if f[1]:upper() ~= f[1] then
table.insert(flags, { hide=true, f[1]:upper(), f[2] })
end
end
end

-- luacheck: no max line length
clink.argmatcher("where")
:setflagsanywhere(false)
:_addexflags(flags)

0 comments on commit 0f83747

Please sign in to comment.