refactor(installer)!: add sync as an option
This commit is contained in:
parent
2bb372966b
commit
2aa86a1bbe
2 changed files with 8 additions and 7 deletions
|
|
@ -37,14 +37,15 @@ local function install_sync(url)
|
||||||
end
|
end
|
||||||
|
|
||||||
---Install required go deps
|
---Install required go deps
|
||||||
---@param sync? boolean
|
---@param opts? {sync:boolean}
|
||||||
function installer.install_deps(sync)
|
function installer.install_deps(opts)
|
||||||
sync = sync or false
|
opts = opts or {}
|
||||||
for pkg, _ in pairs(urls) do
|
for pkg, _ in pairs(urls) do
|
||||||
if sync then
|
local url = urls[pkg] .. "@latest"
|
||||||
install_sync(urls[pkg] .. "@latest")
|
if opts.sync then
|
||||||
|
install_sync(url)
|
||||||
else
|
else
|
||||||
install(urls[pkg] .. "@latest")
|
install(url)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -11,5 +11,5 @@ command! -nargs=* GoGenerate :lua require"gopher".generate(<f-args>)
|
||||||
command! GoCmt :lua require"gopher".comment()
|
command! GoCmt :lua require"gopher".comment()
|
||||||
command! GoIfErr :lua require"gopher".iferr()
|
command! GoIfErr :lua require"gopher".iferr()
|
||||||
command! GoInstallDeps :lua require"gopher".install_deps()
|
command! GoInstallDeps :lua require"gopher".install_deps()
|
||||||
command! GoInstallDepsSync :lua require"gopher".install_deps(true)
|
command! GoInstallDepsSync :lua require"gopher".install_deps({ sync = true })
|
||||||
command! GopherLog :lua vim.cmd("tabnew " .. require("gopher._utils.log").get_outfile())
|
command! GopherLog :lua vim.cmd("tabnew " .. require("gopher._utils.log").get_outfile())
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue