File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,19 +6,9 @@ local serpent = require "fzf-lua.lib.serpent"
66
77local M = {}
88
9- --- @param cmd string
10- --- @param ...string
11- function M .run_command (cmd , ...)
9+ function M .parse_args_to_opts (...)
1210 local args = { ... }
13- cmd = cmd or " builtin"
14-
15- if not builtin [cmd ] then
16- utils .error (" invalid command '%s'" , cmd )
17- return
18- end
19-
2011 local opts = {}
21-
2212 for _ , arg in ipairs (args ) do
2313 local key = arg :match (" ^[^=]+" )
2414 local val = arg :match (" =" ) and arg :match (" =(.*)$" )
@@ -33,7 +23,18 @@ function M.run_command(cmd, ...)
3323 end
3424 end
3525 end
26+ return opts
27+ end
3628
29+ --- @param cmd string
30+ --- @param ...string
31+ function M .run_command (cmd , ...)
32+ cmd = cmd or " builtin"
33+ if not builtin [cmd ] then
34+ utils .error (" invalid command '%s'" , cmd )
35+ return
36+ end
37+ local opts = M .parse_args_to_opts (... )
3738 builtin [cmd ](opts )
3839end
3940
You can’t perform that action at this time.
0 commit comments