mirror of https://github.com/Hilbis/Hilbish
feat: auto start lua modules (closes #167)
parent
453ba9f8ad
commit
362bb14d7e
|
@ -55,6 +55,8 @@ having and using multiple runners.
|
||||||
- .. and 2 properties
|
- .. and 2 properties
|
||||||
- `fs.pathSep` is the separator for filesystem paths and directories
|
- `fs.pathSep` is the separator for filesystem paths and directories
|
||||||
- `fs.pathListSep` is the separator for $PATH env entries
|
- `fs.pathListSep` is the separator for $PATH env entries
|
||||||
|
- Lua modules located in `hilbish.userDir.data .. '/hilbish/start'` (like `~/.local/share/hilbish/start/foo/init.lua`)
|
||||||
|
will be ran on startup
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- **Breaking Change:** Upgraded to Lua 5.4.
|
- **Breaking Change:** Upgraded to Lua 5.4.
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
-- Prelude initializes everything else for our shell
|
-- Prelude initializes everything else for our shell
|
||||||
local _ = require 'succulent' -- Function additions
|
local _ = require 'succulent' -- Function additions
|
||||||
|
local fs = require 'fs'
|
||||||
|
|
||||||
package.path = package.path .. ';' .. hilbish.dataDir .. '/?/init.lua'
|
package.path = package.path .. ';' .. hilbish.dataDir .. '/?/init.lua'
|
||||||
.. ';' .. hilbish.dataDir .. '/?/?.lua' .. ";" .. hilbish.dataDir .. '/?.lua'
|
.. ';' .. hilbish.dataDir .. '/?/?.lua' .. ";" .. hilbish.dataDir .. '/?.lua'
|
||||||
|
@ -45,3 +46,20 @@ do
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
do
|
||||||
|
local startSearchPath = hilbish.userDir.data .. '/hilbish/start/?/init.lua;'
|
||||||
|
.. hilbish.userDir.data .. '/hilbish/start/?.lua'
|
||||||
|
|
||||||
|
local ok, modules = pcall(fs.readdir, hilbish.userDir.data .. '/hilbish/start/')
|
||||||
|
if ok then
|
||||||
|
for _, module in ipairs(modules) do
|
||||||
|
local entry = package.searchpath(module, startSearchPath)
|
||||||
|
print(entry)
|
||||||
|
if entry then
|
||||||
|
dofile(entry)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
package.path = package.path .. ';' .. startSearchPath
|
||||||
|
end
|
||||||
|
|
Loading…
Reference in New Issue