feat: add motd (closes #185)

lua-history
TorchedSammy 2022-07-09 17:54:21 -04:00
parent a106f4aea0
commit 6eea5bce47
Signed by: sammyette
GPG Key ID: 904FC49417B44DCD
3 changed files with 18 additions and 1 deletions

View File

@ -62,6 +62,9 @@ having and using multiple runners.
- Lua modules located in `hilbish.userDir.data .. '/hilbish/start'` (like `~/.local/share/hilbish/start/foo/init.lua`) - Lua modules located in `hilbish.userDir.data .. '/hilbish/start'` (like `~/.local/share/hilbish/start/foo/init.lua`)
will be ran on startup will be ran on startup
- `hilbish.init` hook, thrown after Hilbish has initialized Lua side - `hilbish.init` hook, thrown after Hilbish has initialized Lua side
- Message of the day on startup (`hilbish.motd`), mainly intended as quick
small news pieces for releases. It is printed by default. To disable it,
set `hilbish.opts.motd` to false.
### Changed ### Changed
- **Breaking Change:** Upgraded to Lua 5.4. - **Breaking Change:** Upgraded to Lua 5.4.

View File

@ -23,7 +23,8 @@ local defaultOpts = {
autocd = false, autocd = false,
greeting = string.format([[Welcome to {magenta}Hilbish{reset}, {cyan}%s{reset}. greeting = string.format([[Welcome to {magenta}Hilbish{reset}, {cyan}%s{reset}.
The nice lil shell for {blue}Lua{reset} fanatics! The nice lil shell for {blue}Lua{reset} fanatics!
]], hilbish.user) ]], hilbish.user),
motd = true
} }
for optsName, default in pairs(defaultOpts) do for optsName, default in pairs(defaultOpts) do

View File

@ -0,0 +1,13 @@
local bait = require 'bait'
local lunacolors = require 'lunacolors'
hilbish.motd = [[
Hilbish 2.0 is a {red}major{reset} update! If your config doesn't work
anymore, that will definitely be why! A MOTD, very message, much day.
]]
bait.catch('hilbish.init', function()
if hilbish.opts.motd then
print(lunacolors.format(hilbish.motd))
end
end)