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, "catch", luar.New(L, b.bcatch))
|
||||
L.SetField(mod, "catchOnce", luar.New(L, b.bcatchOnce))
|
||||
|
||||
L.Push(mod)
|
||||
|
||||
|
@ -56,9 +55,3 @@ func (b *Bait) bthrow(name string, args ...interface{}) {
|
|||
func (b *Bait) bcatch(name string, catcher func(...interface{})) {
|
||||
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 = {}
|
||||
|
||||
ansikit.clear = function(scrollback)
|
||||
local typ = (scrollback and 3 or 2)
|
||||
typ = (scrollback and 3 or 2)
|
||||
return ansikit.printCSI(typ, 'J')
|
||||
end
|
||||
|
||||
ansikit.clearFromPos = function()
|
||||
ansikit.clearFromPos = function(scrollback)
|
||||
return ansikit.printCSI(0, 'J')
|
||||
end
|
||||
|
||||
|
@ -79,7 +79,7 @@ end
|
|||
|
||||
ansikit.link = function(url, text)
|
||||
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')
|
||||
end
|
||||
|
||||
|
|
17
preload.lua
17
preload.lua
|
@ -1,9 +1,9 @@
|
|||
-- The preload file initializes everything else for our shell
|
||||
local bait = require 'bait'
|
||||
local commander = require 'commander'
|
||||
|
||||
local fs = require 'fs'
|
||||
local lunacolors = require 'lunacolors'
|
||||
local _ require 'succulent' -- Function additions
|
||||
local commander = require 'commander'
|
||||
local bait = require 'bait'
|
||||
require 'succulent' -- Function additions
|
||||
local oldDir = hilbish.cwd()
|
||||
|
||||
local shlvl = tonumber(os.getenv 'SHLVL')
|
||||
|
@ -37,6 +37,8 @@ commander.register('cd', function (args)
|
|||
end
|
||||
fs.cd(hilbish.home)
|
||||
bait.throw('cd', hilbish.home)
|
||||
|
||||
return
|
||||
end)
|
||||
|
||||
commander.register('exit', function()
|
||||
|
@ -72,8 +74,8 @@ These are the global Hilbish functions that are always available and not part of
|
|||
return
|
||||
end
|
||||
funcdocs = f:read '*a'
|
||||
local subdocs = table.map(fs.readdir(moddocPath), function(fname)
|
||||
return lunacolors.underline(lunacolors.blue(string.gsub(fname, '.txt', '')))
|
||||
local subdocs = table.map(fs.readdir(moddocPath), function(f)
|
||||
return lunacolors.underline(lunacolors.blue(string.gsub(f, '.txt', '')))
|
||||
end)
|
||||
if subdocName == 'index' then
|
||||
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: ]]
|
||||
|
||||
print(table.concat(modules, ', '))
|
||||
|
||||
return
|
||||
end)
|
||||
|
||||
do
|
||||
|
@ -203,6 +207,7 @@ to get a list of recent directories, use {green}{underline}cdr list{reset}]])
|
|||
end
|
||||
|
||||
fs.cd(recentDirs[index])
|
||||
return
|
||||
end)
|
||||
|
||||
-- Hook handles
|
||||
|
|
Loading…
Reference in New Issue