mirror of
				https://github.com/sammy-ette/Hilbish
				synced 2025-08-10 02:52:03 +00:00 
			
		
		
		
	feat: add motd (closes #185)
This commit is contained in:
		
							parent
							
								
									a106f4aea0
								
							
						
					
					
						commit
						6eea5bce47
					
				@ -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.
 | 
				
			||||||
 | 
				
			|||||||
@ -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
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										13
									
								
								nature/opts/motd.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								nature/opts/motd.lua
									
									
									
									
									
										Normal 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)
 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user