Skip to content

Commit

Permalink
feat: add hilbish.midnightEdition
Browse files Browse the repository at this point in the history
  • Loading branch information
TorchedSammy committed Dec 22, 2024
1 parent 7620660 commit 40d3933
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 13 deletions.
2 changes: 2 additions & 0 deletions .hilbishrc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ local function doNotifyPrompt()
end

doPrompt()
--[[
bait.catch('command.preexec', function()
running = true
Expand All @@ -47,3 +48,4 @@ end)
bait.catch('hilbish.notification', function(notif)
doNotifyPrompt()
end)
]]--
9 changes: 7 additions & 2 deletions api.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ func hilbishLoader(mlr *moonlight.Runtime) moonlight.Value {
"hinter": {hlhinter, 1, false},
"multiprompt": {hlmultiprompt, 1, false},
"prependPath": {hlprependPath, 1, false},
*/
"prompt": {hlprompt, 1, true},
/*
"inputMode": {hlinputMode, 1, false},
"interval": {hlinterval, 2, false},
"read": {hlread, 1, false},
Expand Down Expand Up @@ -80,6 +82,7 @@ func hilbishLoader(mlr *moonlight.Runtime) moonlight.Value {
hshMod.SetField("interactive", moonlight.BoolValue(interactive))
hshMod.SetField("login", moonlight.BoolValue(login))
hshMod.SetField("exitCode", moonlight.IntValue(0))
hshMod.SetField("midnightEdition", moonlight.BoolValue(moonlight.IsMidnight()))

Check failure on line 85 in api.go

View workflow job for this annotation

GitHub Actions / linux-386

undefined: moonlight.IsMidnight

Check failure on line 85 in api.go

View workflow job for this annotation

GitHub Actions / linux-amd64

undefined: moonlight.IsMidnight

Check failure on line 85 in api.go

View workflow job for this annotation

GitHub Actions / windows-386

undefined: moonlight.IsMidnight

Check failure on line 85 in api.go

View workflow job for this annotation

GitHub Actions / darwin-amd64

undefined: moonlight.IsMidnight

Check failure on line 85 in api.go

View workflow job for this annotation

GitHub Actions / darwin-arm64

undefined: moonlight.IsMidnight

Check failure on line 85 in api.go

View workflow job for this annotation

GitHub Actions / linux-amd64

undefined: moonlight.IsMidnight

Check failure on line 85 in api.go

View workflow job for this annotation

GitHub Actions / linux-arm64

undefined: moonlight.IsMidnight

Check failure on line 85 in api.go

View workflow job for this annotation

GitHub Actions / windows-386

undefined: moonlight.IsMidnight

Check failure on line 85 in api.go

View workflow job for this annotation

GitHub Actions / windows-amd64

undefined: moonlight.IsMidnight
//util.SetField(rtm, mod, "vimMode", rt.NilValue)

// hilbish.userDir table
Expand Down Expand Up @@ -130,8 +133,10 @@ func hilbishLoader(mlr *moonlight.Runtime) moonlight.Value {
//mod.Set(rt.StringValue("version"), rt.TableValue(versionModule))

// very meta
//moduleModule := moduleLoader(mlr)
//hshMod.SetField("module", moonlight.TableValue(moduleModule))
if moonlight.IsMidnight() {

Check failure on line 136 in api.go

View workflow job for this annotation

GitHub Actions / linux-386

undefined: moonlight.IsMidnight

Check failure on line 136 in api.go

View workflow job for this annotation

GitHub Actions / linux-amd64

undefined: moonlight.IsMidnight

Check failure on line 136 in api.go

View workflow job for this annotation

GitHub Actions / windows-386

undefined: moonlight.IsMidnight

Check failure on line 136 in api.go

View workflow job for this annotation

GitHub Actions / darwin-amd64

undefined: moonlight.IsMidnight

Check failure on line 136 in api.go

View workflow job for this annotation

GitHub Actions / darwin-arm64

undefined: moonlight.IsMidnight

Check failure on line 136 in api.go

View workflow job for this annotation

GitHub Actions / linux-amd64

undefined: moonlight.IsMidnight

Check failure on line 136 in api.go

View workflow job for this annotation

GitHub Actions / linux-arm64

undefined: moonlight.IsMidnight

Check failure on line 136 in api.go

View workflow job for this annotation

GitHub Actions / windows-386

undefined: moonlight.IsMidnight

Check failure on line 136 in api.go

View workflow job for this annotation

GitHub Actions / windows-amd64

undefined: moonlight.IsMidnight
moduleModule := moduleLoader(mlr)
hshMod.SetField("module", moonlight.TableValue(moduleModule))
}

return moonlight.TableValue(hshMod)
}
Expand Down
2 changes: 1 addition & 1 deletion moonlight/value_clua.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func TableValue(t *Table) Value {
}

func FunctionValue(f Callable) Value {
return NilValue
return Value{iface: f}
}

func AsValue(i interface{}) Value {
Expand Down
24 changes: 14 additions & 10 deletions nature/init.lua
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
-- Prelude initializes everything else for our shell
--[[
local _ = require 'succulent' -- Function additions
local bait = require 'bait'
local fs = require 'fs'
--local fs = require 'fs'
package.path = package.path .. ';' .. hilbish.dataDir .. '/?/init.lua'
.. ';' .. hilbish.dataDir .. '/?/?.lua' .. ";" .. hilbish.dataDir .. '/?.lua'
hilbish.module.paths = '?.so;?/?.so;'
.. hilbish.userDir.data .. 'hilbish/libs/?/?.so'
.. ";" .. hilbish.userDir.data .. 'hilbish/libs/?.so'
if not hilbish.midnightEdition then
hilbish.module.paths = '?.so;?/?.so;'
.. hilbish.userDir.data .. 'hilbish/libs/?/?.so'
.. ";" .. hilbish.userDir.data .. 'hilbish/libs/?.so'
table.insert(package.searchers, function(module)
local path = package.searchpath(module, hilbish.module.paths)
if not path then return nil end
table.insert(package.searchers, function(module)
local path = package.searchpath(module, hilbish.module.paths)
if not path then return nil end
-- it didnt work normally, idk
return function() return hilbish.module.load(path) end, path
end)
-- it didnt work normally, idk
return function() return hilbish.module.load(path) end, path
end)
end
require 'nature.commands'
require 'nature.completions'
Expand Down Expand Up @@ -90,3 +93,4 @@ end)
bait.catch('command.not-executable', function(cmd)
print(string.format('hilbish: %s: not executable', cmd))
end)
]]--

0 comments on commit 40d3933

Please sign in to comment.