feat: add goget support
feat(goget): remove http or https from provided url
This commit is contained in:
parent
f507a37a72
commit
04e1af228b
4 changed files with 38 additions and 0 deletions
27
lua/gopher/goget.lua
Normal file
27
lua/gopher/goget.lua
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
local Job = require "plenary.job"
|
||||
|
||||
return function(...)
|
||||
local args = { ... }
|
||||
for i, arg in ipairs(args) do
|
||||
local m = string.match(arg, "^https://(.*)$") or string.match(arg, "^http://(.*)$") or arg
|
||||
table.remove(args, i)
|
||||
table.insert(args, i, m)
|
||||
end
|
||||
|
||||
local cmd_args = vim.list_extend({ "get" }, args)
|
||||
|
||||
Job
|
||||
:new({
|
||||
command = "go",
|
||||
args = cmd_args,
|
||||
on_exit = function(_, retval)
|
||||
if retval ~= 0 then
|
||||
print("command exited with code " .. retval)
|
||||
return
|
||||
else
|
||||
print "command runs successfully"
|
||||
end
|
||||
end,
|
||||
})
|
||||
:start()
|
||||
end
|
||||
|
|
@ -5,5 +5,6 @@ gopher.install_deps = require("gopher.installer").install_all
|
|||
gopher.tags_add = tags.add
|
||||
gopher.tags_rm = tags.remove
|
||||
gopher.mod = require "gopher.gomod"
|
||||
gopher.get = require "gopher.goget"
|
||||
|
||||
return gopher
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue