mirror of
				https://github.com/sammy-ette/Hilbish
				synced 2025-08-10 02:52:03 +00:00 
			
		
		
		
	feat: add hilbish.midnightEdition
This commit is contained in:
		
							parent
							
								
									762066022d
								
							
						
					
					
						commit
						40d3933009
					
				@ -25,6 +25,7 @@ local function doNotifyPrompt()
 | 
				
			|||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
doPrompt()
 | 
					doPrompt()
 | 
				
			||||||
 | 
					--[[
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bait.catch('command.preexec', function()
 | 
					bait.catch('command.preexec', function()
 | 
				
			||||||
	running = true
 | 
						running = true
 | 
				
			||||||
@ -47,3 +48,4 @@ end)
 | 
				
			|||||||
bait.catch('hilbish.notification', function(notif)
 | 
					bait.catch('hilbish.notification', function(notif)
 | 
				
			||||||
	doNotifyPrompt()
 | 
						doNotifyPrompt()
 | 
				
			||||||
end)
 | 
					end)
 | 
				
			||||||
 | 
					]]--
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										9
									
								
								api.go
									
									
									
									
									
								
							
							
						
						
									
										9
									
								
								api.go
									
									
									
									
									
								
							@ -51,7 +51,9 @@ func hilbishLoader(mlr *moonlight.Runtime) moonlight.Value {
 | 
				
			|||||||
		"hinter": {hlhinter, 1, false},
 | 
							"hinter": {hlhinter, 1, false},
 | 
				
			||||||
		"multiprompt": {hlmultiprompt, 1, false},
 | 
							"multiprompt": {hlmultiprompt, 1, false},
 | 
				
			||||||
		"prependPath": {hlprependPath, 1, false},
 | 
							"prependPath": {hlprependPath, 1, false},
 | 
				
			||||||
 | 
							*/
 | 
				
			||||||
		"prompt": {hlprompt, 1, true},
 | 
							"prompt": {hlprompt, 1, true},
 | 
				
			||||||
 | 
							/*
 | 
				
			||||||
		"inputMode": {hlinputMode, 1, false},
 | 
							"inputMode": {hlinputMode, 1, false},
 | 
				
			||||||
		"interval": {hlinterval, 2, false},
 | 
							"interval": {hlinterval, 2, false},
 | 
				
			||||||
		"read": {hlread, 1, false},
 | 
							"read": {hlread, 1, false},
 | 
				
			||||||
@ -80,6 +82,7 @@ func hilbishLoader(mlr *moonlight.Runtime) moonlight.Value {
 | 
				
			|||||||
	hshMod.SetField("interactive", moonlight.BoolValue(interactive))
 | 
						hshMod.SetField("interactive", moonlight.BoolValue(interactive))
 | 
				
			||||||
	hshMod.SetField("login", moonlight.BoolValue(login))
 | 
						hshMod.SetField("login", moonlight.BoolValue(login))
 | 
				
			||||||
	hshMod.SetField("exitCode", moonlight.IntValue(0))
 | 
						hshMod.SetField("exitCode", moonlight.IntValue(0))
 | 
				
			||||||
 | 
						hshMod.SetField("midnightEdition", moonlight.BoolValue(moonlight.IsMidnight()))
 | 
				
			||||||
	//util.SetField(rtm, mod, "vimMode", rt.NilValue)
 | 
						//util.SetField(rtm, mod, "vimMode", rt.NilValue)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// hilbish.userDir table
 | 
						// hilbish.userDir table
 | 
				
			||||||
@ -130,8 +133,10 @@ func hilbishLoader(mlr *moonlight.Runtime) moonlight.Value {
 | 
				
			|||||||
	//mod.Set(rt.StringValue("version"), rt.TableValue(versionModule))
 | 
						//mod.Set(rt.StringValue("version"), rt.TableValue(versionModule))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// very meta
 | 
						// very meta
 | 
				
			||||||
	//moduleModule := moduleLoader(mlr)
 | 
						if moonlight.IsMidnight() {
 | 
				
			||||||
	//hshMod.SetField("module", moonlight.TableValue(moduleModule))
 | 
							moduleModule := moduleLoader(mlr)
 | 
				
			||||||
 | 
							hshMod.SetField("module", moonlight.TableValue(moduleModule))
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return moonlight.TableValue(hshMod)
 | 
						return moonlight.TableValue(hshMod)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -41,7 +41,7 @@ func TableValue(t *Table) Value {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func FunctionValue(f Callable) Value {
 | 
					func FunctionValue(f Callable) Value {
 | 
				
			||||||
	return NilValue
 | 
						return Value{iface: f}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func AsValue(i interface{}) Value {
 | 
					func AsValue(i interface{}) Value {
 | 
				
			||||||
 | 
				
			|||||||
@ -1,22 +1,25 @@
 | 
				
			|||||||
-- 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 bait = require 'bait'
 | 
					local bait = require 'bait'
 | 
				
			||||||
local fs = require 'fs'
 | 
					--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'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
hilbish.module.paths = '?.so;?/?.so;'
 | 
					if not hilbish.midnightEdition then
 | 
				
			||||||
.. hilbish.userDir.data .. 'hilbish/libs/?/?.so'
 | 
						hilbish.module.paths = '?.so;?/?.so;'
 | 
				
			||||||
.. ";" .. hilbish.userDir.data .. 'hilbish/libs/?.so'
 | 
						.. hilbish.userDir.data .. 'hilbish/libs/?/?.so'
 | 
				
			||||||
 | 
						.. ";" .. hilbish.userDir.data .. 'hilbish/libs/?.so'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
table.insert(package.searchers, function(module)
 | 
						table.insert(package.searchers, function(module)
 | 
				
			||||||
		local path = package.searchpath(module, hilbish.module.paths)
 | 
							local path = package.searchpath(module, hilbish.module.paths)
 | 
				
			||||||
		if not path then return nil end
 | 
							if not path then return nil end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		-- it didnt work normally, idk
 | 
							-- it didnt work normally, idk
 | 
				
			||||||
		return function() return hilbish.module.load(path) end, path
 | 
							return function() return hilbish.module.load(path) end, path
 | 
				
			||||||
end)
 | 
						end)
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
require 'nature.commands'
 | 
					require 'nature.commands'
 | 
				
			||||||
require 'nature.completions'
 | 
					require 'nature.completions'
 | 
				
			||||||
@ -90,3 +93,4 @@ end)
 | 
				
			|||||||
bait.catch('command.not-executable', function(cmd)
 | 
					bait.catch('command.not-executable', function(cmd)
 | 
				
			||||||
	print(string.format('hilbish: %s: not executable', cmd))
 | 
						print(string.format('hilbish: %s: not executable', cmd))
 | 
				
			||||||
end)
 | 
					end)
 | 
				
			||||||
 | 
					]]--
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user