mirror of https://github.com/Hilbis/Hilbish
Compare commits
No commits in common. "51b1219003acaaa515f5b105476c35a4d011f32b" and "2e21af4d6bf3740ffac86cefe1200bb7cab9f154" have entirely different histories.
51b1219003
...
2e21af4d6b
|
@ -38,7 +38,6 @@ failed, etc. To find all available hooks, see doc hooks.`)
|
||||||
|
|
||||||
L.SetField(mod, "throw", luar.New(L, b.bthrow))
|
L.SetField(mod, "throw", luar.New(L, b.bthrow))
|
||||||
L.SetField(mod, "catch", luar.New(L, b.bcatch))
|
L.SetField(mod, "catch", luar.New(L, b.bcatch))
|
||||||
L.SetField(mod, "catchOnce", luar.New(L, b.bcatchOnce))
|
|
||||||
|
|
||||||
L.Push(mod)
|
L.Push(mod)
|
||||||
|
|
||||||
|
@ -56,9 +55,3 @@ func (b *Bait) bthrow(name string, args ...interface{}) {
|
||||||
func (b *Bait) bcatch(name string, catcher func(...interface{})) {
|
func (b *Bait) bcatch(name string, catcher func(...interface{})) {
|
||||||
b.Em.On(name, catcher)
|
b.Em.On(name, catcher)
|
||||||
}
|
}
|
||||||
|
|
||||||
// catchOnce(name, cb)
|
|
||||||
// Same as catch, but only runs the `cb` once and then removes the hook
|
|
||||||
func (b *Bait) bcatchOnce(name string, catcher func(...interface{})) {
|
|
||||||
b.Em.Once(name, catcher)
|
|
||||||
}
|
|
||||||
|
|
|
@ -5,11 +5,11 @@ local lunacolors = require 'lunacolors'
|
||||||
local ansikit = {}
|
local ansikit = {}
|
||||||
|
|
||||||
ansikit.clear = function(scrollback)
|
ansikit.clear = function(scrollback)
|
||||||
local typ = (scrollback and 3 or 2)
|
typ = (scrollback and 3 or 2)
|
||||||
return ansikit.printCSI(typ, 'J')
|
return ansikit.printCSI(typ, 'J')
|
||||||
end
|
end
|
||||||
|
|
||||||
ansikit.clearFromPos = function()
|
ansikit.clearFromPos = function(scrollback)
|
||||||
return ansikit.printCSI(0, 'J')
|
return ansikit.printCSI(0, 'J')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ end
|
||||||
|
|
||||||
ansikit.link = function(url, text)
|
ansikit.link = function(url, text)
|
||||||
if not url then error 'ansikit: missing url for hyperlink' end
|
if not url then error 'ansikit: missing url for hyperlink' end
|
||||||
text = (text and text or 'link')
|
local text = (text and text or 'link')
|
||||||
return lunacolors.blue('\27]8;;' .. url .. '\27\\' .. text .. '\27]8;;\27\\\n')
|
return lunacolors.blue('\27]8;;' .. url .. '\27\\' .. text .. '\27]8;;\27\\\n')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
17
preload.lua
17
preload.lua
|
@ -1,9 +1,9 @@
|
||||||
-- The preload file initializes everything else for our shell
|
-- The preload file initializes everything else for our shell
|
||||||
local bait = require 'bait'
|
|
||||||
local commander = require 'commander'
|
|
||||||
local fs = require 'fs'
|
local fs = require 'fs'
|
||||||
local lunacolors = require 'lunacolors'
|
local commander = require 'commander'
|
||||||
local _ require 'succulent' -- Function additions
|
local bait = require 'bait'
|
||||||
|
require 'succulent' -- Function additions
|
||||||
local oldDir = hilbish.cwd()
|
local oldDir = hilbish.cwd()
|
||||||
|
|
||||||
local shlvl = tonumber(os.getenv 'SHLVL')
|
local shlvl = tonumber(os.getenv 'SHLVL')
|
||||||
|
@ -37,6 +37,8 @@ commander.register('cd', function (args)
|
||||||
end
|
end
|
||||||
fs.cd(hilbish.home)
|
fs.cd(hilbish.home)
|
||||||
bait.throw('cd', hilbish.home)
|
bait.throw('cd', hilbish.home)
|
||||||
|
|
||||||
|
return
|
||||||
end)
|
end)
|
||||||
|
|
||||||
commander.register('exit', function()
|
commander.register('exit', function()
|
||||||
|
@ -72,8 +74,8 @@ These are the global Hilbish functions that are always available and not part of
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
funcdocs = f:read '*a'
|
funcdocs = f:read '*a'
|
||||||
local subdocs = table.map(fs.readdir(moddocPath), function(fname)
|
local subdocs = table.map(fs.readdir(moddocPath), function(f)
|
||||||
return lunacolors.underline(lunacolors.blue(string.gsub(fname, '.txt', '')))
|
return lunacolors.underline(lunacolors.blue(string.gsub(f, '.txt', '')))
|
||||||
end)
|
end)
|
||||||
if subdocName == 'index' then
|
if subdocName == 'index' then
|
||||||
funcdocs = funcdocs .. '\nSubdocs: ' .. table.concat(subdocs, ', ')
|
funcdocs = funcdocs .. '\nSubdocs: ' .. table.concat(subdocs, ', ')
|
||||||
|
@ -133,6 +135,8 @@ A section is a module or a literal section and a subdoc is a subsection for it.
|
||||||
Available sections: ]]
|
Available sections: ]]
|
||||||
|
|
||||||
print(table.concat(modules, ', '))
|
print(table.concat(modules, ', '))
|
||||||
|
|
||||||
|
return
|
||||||
end)
|
end)
|
||||||
|
|
||||||
do
|
do
|
||||||
|
@ -203,6 +207,7 @@ to get a list of recent directories, use {green}{underline}cdr list{reset}]])
|
||||||
end
|
end
|
||||||
|
|
||||||
fs.cd(recentDirs[index])
|
fs.cd(recentDirs[index])
|
||||||
|
return
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- Hook handles
|
-- Hook handles
|
||||||
|
|
Loading…
Reference in New Issue