Fix an issue with clink.find_files() return order not always consistent, leading to .init.lua not being run first lua path being broken (#2278)

This commit is contained in:
Michael Roy 2020-03-14 14:01:06 +01:00 committed by GitHub
parent a92bb1947f
commit 1071221468
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

2
vendor/clink.lua vendored
View File

@ -431,6 +431,8 @@ clink.prompt.register_filter(svn_prompt_filter, 50)
clink.prompt.register_filter(percent_prompt_filter, 51) clink.prompt.register_filter(percent_prompt_filter, 51)
local completions_dir = clink.get_env('CMDER_ROOT')..'/vendor/clink-completions/' local completions_dir = clink.get_env('CMDER_ROOT')..'/vendor/clink-completions/'
-- Execute '.init.lua' first to ensure package.path is set properly
dofile(completions_dir..'.init.lua')
for _,lua_module in ipairs(clink.find_files(completions_dir..'*.lua')) do for _,lua_module in ipairs(clink.find_files(completions_dir..'*.lua')) do
-- Skip files that starts with _. This could be useful if some files should be ignored -- Skip files that starts with _. This could be useful if some files should be ignored
if not string.match(lua_module, '^_.*') then if not string.match(lua_module, '^_.*') then