Skip to content

Commit 3078688

Browse files
committed
ci(minit): LAZY_STDPATH
1 parent cdfea60 commit 3078688

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

lua/lazy/minit.lua

+9-12
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,18 @@
11
---@diagnostic disable: inject-field
2-
---@class LazyMinit:LazyConfig
3-
---@field stdpath? string
42

53
local islist = vim.islist or vim.tbl_islist
64

7-
---@alias MinitSetup (fun(spec:LazySpec, opts: LazyMinit):LazyMinit?) | (fun(opts: LazyMinit):LazyMinit?) | (fun(spec:LazySpec, opts: LazyMinit):LazyMinit?)
8-
95
local M = {}
106

11-
---@param opts LazyMinit
7+
---@param opts LazyConfig
128
---@return LazySpec[]
139
local function get_spec(opts)
1410
local ret = opts.spec or {}
1511
return ret and type(ret) == "table" and islist(ret) and ret or { ret }
1612
end
1713

18-
---@param defaults LazyMinit
19-
---@param opts LazyMinit
14+
---@param defaults LazyConfig
15+
---@param opts LazyConfig
2016
function M.extend(defaults, opts)
2117
local spec = {}
2218
vim.list_extend(spec, get_spec(defaults))
@@ -30,10 +26,11 @@ function M.setup(opts)
3026
}, opts)
3127

3228
-- set stdpaths to use .tests
33-
local root = opts.stdpath or ".minit"
34-
root = vim.fn.fnamemodify(root, ":p")
35-
for _, name in ipairs({ "config", "data", "state", "cache" }) do
36-
vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
29+
if vim.env.LAZY_STDPATH then
30+
local root = vim.fn.fnamemodify(vim.env.LAZY_STDPATH, ":p")
31+
for _, name in ipairs({ "config", "data", "state", "cache" }) do
32+
vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
33+
end
3734
end
3835

3936
vim.o.loadplugins = true
@@ -68,7 +65,7 @@ function M.repro(opts)
6865
M.setup(opts)
6966
end
7067

71-
---@param opts LazyMinit
68+
---@param opts LazyConfig
7269
function M.busted(opts)
7370
opts = M.extend({
7471
spec = {

tests/busted.lua

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/usr/bin/env -S nvim -l
22

3+
vim.env.LAZY_STDPATH = ".tests"
4+
35
vim.opt.rtp:prepend(".")
46

57
-- Setup lazy.nvim

0 commit comments

Comments
 (0)