feat(plugin): add tab completion for :Pending auth subcommands
`:Pending auth <Tab>` completes `gcal gtasks clear reset`; `:Pending auth <backend> <Tab>` completes `clear reset`.
This commit is contained in:
parent
c45aacfcbb
commit
b57cdd20b0
1 changed files with 15 additions and 0 deletions
|
|
@ -213,6 +213,21 @@ end, {
|
||||||
if cmd_line:match('^Pending%s+edit') then
|
if cmd_line:match('^Pending%s+edit') then
|
||||||
return complete_edit(arg_lead, cmd_line)
|
return complete_edit(arg_lead, cmd_line)
|
||||||
end
|
end
|
||||||
|
if cmd_line:match('^Pending%s+auth') then
|
||||||
|
local after_auth = cmd_line:match('^Pending%s+auth%s+(.*)') or ''
|
||||||
|
local parts = {}
|
||||||
|
for w in after_auth:gmatch('%S+') do
|
||||||
|
table.insert(parts, w)
|
||||||
|
end
|
||||||
|
local trailing = after_auth:match('%s$')
|
||||||
|
if #parts == 0 or (#parts == 1 and not trailing) then
|
||||||
|
return filter_candidates(arg_lead, { 'gcal', 'gtasks', 'clear', 'reset' })
|
||||||
|
end
|
||||||
|
if #parts == 1 or (#parts == 2 and not trailing) then
|
||||||
|
return filter_candidates(arg_lead, { 'clear', 'reset' })
|
||||||
|
end
|
||||||
|
return {}
|
||||||
|
end
|
||||||
local backend_set = pending.sync_backend_set()
|
local backend_set = pending.sync_backend_set()
|
||||||
local matched_backend = cmd_line:match('^Pending%s+(%S+)')
|
local matched_backend = cmd_line:match('^Pending%s+(%S+)')
|
||||||
if matched_backend and backend_set[matched_backend] then
|
if matched_backend and backend_set[matched_backend] then
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue