mirror of
https://github.com/mpv-player/mpv
synced 2024-12-27 09:32:40 +00:00
console.lua: remove repetition from build_completers()
This commit is contained in:
parent
b9ab8d1a6c
commit
b89f0ad411
@ -649,20 +649,25 @@ function build_completers()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return {
|
local completers = {
|
||||||
{ pattern = '^%s*()[%w_-]+()$', list = cmd_list, append = ' ' },
|
{ pattern = '^%s*()[%w_-]+()$', list = cmd_list, append = ' ' },
|
||||||
{ pattern = '^%s*set%s+()[%w_/-]+()$', list = prop_list, append = ' ' },
|
|
||||||
{ pattern = '^%s*set%s+"()[%w_/-]+()$', list = prop_list, append = '" ' },
|
|
||||||
{ pattern = '^%s*add%s+()[%w_/-]+()$', list = prop_list, append = ' ' },
|
|
||||||
{ pattern = '^%s*add%s+"()[%w_/-]+()$', list = prop_list, append = '" ' },
|
|
||||||
{ pattern = '^%s*cycle%s+()[%w_/-]+()$', list = prop_list, append = ' ' },
|
|
||||||
{ pattern = '^%s*cycle%s+"()[%w_/-]+()$', list = prop_list, append = '" ' },
|
|
||||||
{ pattern = '^%s*cycle%-values%s+()[%w_/-]+()$', list = prop_list, append = ' ' },
|
|
||||||
{ pattern = '^%s*cycle%-values%s+"()[%w_/-]+()$', list = prop_list, append = '" ' },
|
|
||||||
{ pattern = '^%s*multiply%s+()[%w_/-]+()$', list = prop_list, append = ' ' },
|
|
||||||
{ pattern = '^%s*multiply%s+"()[%w_/-]+()$', list = prop_list, append = '" ' },
|
|
||||||
{ pattern = '${()[%w_/-]+()$', list = prop_list, append = '}' },
|
{ pattern = '${()[%w_/-]+()$', list = prop_list, append = '}' },
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for _, command in pairs({'set', 'add', 'cycle', 'cycle[-_]values', 'multiply'}) do
|
||||||
|
completers[#completers + 1] = {
|
||||||
|
pattern = '^%s*' .. command .. '%s+()[%w_/-]+()$',
|
||||||
|
list = prop_list,
|
||||||
|
append = ' ',
|
||||||
|
}
|
||||||
|
completers[#completers + 1] = {
|
||||||
|
pattern = '^%s*' .. command .. '%s+"()[%w_/-]+()$',
|
||||||
|
list = prop_list,
|
||||||
|
append = '" ',
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
return completers
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Use 'list' to find possible tab-completions for 'part.'
|
-- Use 'list' to find possible tab-completions for 'part.'
|
||||||
|
Loading…
Reference in New Issue
Block a user