+1
.envrc
+1
.envrc
-10
.luarc.json
-10
.luarc.json
-12
lua/gopher/_utils/init.lua
-12
lua/gopher/_utils/init.lua
···
4
5
---@param msg string
6
---@param lvl? number
7
-
function utils.deferred_notify(msg, lvl)
8
-
lvl = lvl or vim.log.levels.INFO
9
-
vim.defer_fn(function()
10
-
vim.notify(msg, lvl, {
11
-
title = c.___plugin_name,
12
-
})
13
-
log.debug(msg)
14
-
end, 0)
15
-
end
16
-
17
-
---@param msg string
18
-
---@param lvl? number
19
function utils.notify(msg, lvl)
20
lvl = lvl or vim.log.levels.INFO
21
vim.notify(msg, lvl, {
lua/gopher/_utils/runner/gocmd.lua
lua/gopher/_utils/gocmd.lua
lua/gopher/_utils/runner/gocmd.lua
lua/gopher/_utils/gocmd.lua
lua/gopher/_utils/runner/init.lua
lua/gopher/_utils/runner.lua
lua/gopher/_utils/runner/init.lua
lua/gopher/_utils/runner.lua
+1
-1
lua/gopher/init.lua
+1
-1
lua/gopher/init.lua
+8
-3
lua/gopher/installer.lua
+8
-3
lua/gopher/installer.lua
···
15
---@param url string
16
local function handle_intall_exit(opt, url)
17
if opt.code ~= 0 then
18
-
u.deferred_notify("go install failed: " .. url)
19
log.error("go install failed:", "url", url, "opt", vim.inspect(opt))
20
return
21
end
22
23
-
u.deferred_notify("go install-ed: " .. url)
24
end
25
26
---@param url string
···
40
---@param opts? {sync:boolean}
41
function installer.install_deps(opts)
42
opts = opts or {}
43
-
for url, _ in pairs(urls) do
44
if opts.sync then
45
install_sync(url)
46
else
···
15
---@param url string
16
local function handle_intall_exit(opt, url)
17
if opt.code ~= 0 then
18
+
vim.schedule(function()
19
+
u.notify("go install failed: " .. url)
20
+
end)
21
+
22
log.error("go install failed:", "url", url, "opt", vim.inspect(opt))
23
return
24
end
25
26
+
vim.schedule(function()
27
+
u.notify("go install-ed: " .. url)
28
+
end)
29
end
30
31
---@param url string
···
45
---@param opts? {sync:boolean}
46
function installer.install_deps(opts)
47
opts = opts or {}
48
+
for _, url in pairs(urls) do
49
if opts.sync then
50
install_sync(url)
51
else
+29
spec/unit/utils_test.lua
+29
spec/unit/utils_test.lua
···
···
1
+
local t = require "spec.testutils"
2
+
local child = MiniTest.new_child_neovim()
3
+
local T = MiniTest.new_set {
4
+
hooks = {
5
+
post_once = child.stop,
6
+
pre_case = function()
7
+
child.restart { "-u", t.mininit_path }
8
+
end,
9
+
},
10
+
}
11
+
12
+
T["utils"] = MiniTest.new_set()
13
+
T["utils"]["should .remove_empty_lines()"] = function()
14
+
local u = require "gopher._utils"
15
+
local inp = { "hi", "", "a", "", "", "asdf" }
16
+
17
+
t.eq(u.remove_empty_lines(inp), { "hi", "a", "asdf" })
18
+
end
19
+
20
+
T["utils"]["should .readfile_joined()"] = function()
21
+
local data = "line1\nline2\nline3"
22
+
local tmp = t.tmpfile()
23
+
local u = require "gopher._utils"
24
+
25
+
t.writefile(tmp, data)
26
+
t.eq(u.readfile_joined(tmp), data)
27
+
end
28
+
29
+
return T