@@ -3,11 +3,25 @@ local overseer = require("overseer")
33--- @param opts overseer.SearchParams
44--- @return nil | string
55local function get_mise_file (opts )
6- local is_misefile = function (name )
6+ local function is_mise_file (name )
77 name = name :lower ()
8- return name == " mise.toml" or name == " .mise.toml"
8+ -- mise.toml, mise.<env>.toml, or .local.toml, or dot-prefixed
9+ return name :match (" ^%.?mise%.toml$" ) ~= nil
10+ or name :match (" ^%.?mise%.local%.toml$" ) ~= nil
11+ or name :match (" ^%.?mise%.%w+%.toml$" ) ~= nil
12+ or name :match (" ^%.?mise%.%w+%.local%.toml$" ) ~= nil
913 end
10- return vim .fs .find (is_misefile , { upward = true , path = opts .dir })[1 ]
14+
15+ local function is_mise_dir (name )
16+ name = name :lower ()
17+ -- (.)mise, (.)mise-tasks, or .config dir
18+ return name :match (" ^%.?mise$" ) ~= nil
19+ or name :match (" ^%.?mise%-tasks$" ) ~= nil
20+ or name == " .config"
21+ end
22+
23+ return vim .fs .find (is_mise_file , { type = " file" , upward = true , path = opts .dir [1 ] })[1 ]
24+ or vim .fs .find (is_mise_dir , { type = " directory" , upward = true , path = opts .dir [1 ] })[1 ]
1125end
1226
1327--- @type overseer.TemplateFileProvider
@@ -21,7 +35,7 @@ local provider = {
2135 end
2236 local mise_file = get_mise_file (opts )
2337 if not mise_file then
24- return " No mise.toml found"
38+ return " No mise file or directory found"
2539 end
2640
2741 local ret = {}
0 commit comments