2
2
鏡像自 https://github.com/Hilbis/Hilbish synced 2025-07-15 15:22:03 +00:00

比較提交

..

沒有共同的提交。「4b57dc2ed887655ac91e36da3b1250e88e16a479」和「29c1e29bb72b95399aed628222bf818f600c7ab0」的歷史完全不同。

共有 11 個檔案被更改,包括 9 行新增35 行删除

查看文件

@ -1,9 +1,8 @@
-- Default Hilbish config
local lunacolors = require 'lunacolors'
local bait = require 'bait'
local ansikit = require 'ansikit'
local function doPrompt(fail, mode)
function doPrompt(fail)
hilbish.prompt(lunacolors.format(
'{blue}%u {cyan}%d ' .. (fail and '{red}' or '{green}') .. ''
))
@ -17,12 +16,3 @@ bait.catch('command.exit', function(code)
doPrompt(code ~= 0)
end)
bait.catch('hilbish.vimMode', function(mode)
if mode ~= 'insert' then
ansikit.cursorStyle(ansikit.blockCursor)
else
ansikit.cursorStyle(ansikit.lineCursor)
end
doPrompt(false, mode)
end)

3
api.go
查看文件

@ -65,7 +65,6 @@ The nice lil shell for {blue}Lua{reset} fanatics!
util.SetField(L, mod, "login", lua.LBool(interactive), "Whether this is a login shell")
util.SetField(L, mod, "greeting", lua.LString(greeting), "Hilbish's welcome message for interactive shells. It has Lunacolors formatting.")
util.SetField(l, mod, "vimMode", lua.LNil, "Current Vim mode of Hilbish (nil if not in Vim mode)")
util.SetField(l, hshMod, "exitCode", lua.LNumber(0), "Exit code of last exected command")
util.Document(L, mod, "Hilbish's core API, containing submodules and functions which relate to the shell itself.")
// hilbish.userDir table
@ -155,8 +154,8 @@ func luaBinaryComplete(L *lua.LState) int {
}
func setVimMode(mode string) {
util.SetField(l, hshMod, "vimMode", lua.LString(mode), "Current Vim mode of Hilbish (nil if not in Vim mode)")
hooks.Em.Emit("hilbish.vimMode", mode)
util.SetField(l, hshMod, "vimMode", lua.LString(mode), "Current Vim mode of Hilbish (nil if not in Vim mode)")
}
func unsetVimMode() {

查看文件

@ -1,3 +0,0 @@
+ `hilbish.exit` > Sent when Hilbish is about to exit.
+ `hilbish.vimMode` > Sent when Hilbish's Vim mode is changed (example insert to normal mode)

查看文件

@ -1,5 +1,5 @@
Here is a list of bait hooks that are thrown by Hilbish. If a hook is related
to a command, it will have the `command` scope, as example.
Here is listed all scopes for bait hooks. If a hook is related to a command,
it will have the `command` scope, as example.
Here is the format for a doc for a hook:
+ <hook name> -> <args> > <description>

查看文件

@ -1,7 +1,4 @@
+ `signal.sigint` > Sent when Hilbish receives SIGINT (on Ctrl-C).
+ `signal.resize` > Sent when the terminal is resized.
+ `signal.sigusr1`
+ `signal.sigusr2`

查看文件

@ -244,6 +244,5 @@ func cmdFinish(code uint8, cmdstr, oldInput string) {
if !strings.HasPrefix(oldInput, " ") || interactive {
handleHistory(cmdstr)
}
util.SetField(l, hshMod, "exitCode", lua.LNumber(code), "Exit code of last exected command")
hooks.Em.Emit("command.exit", code, cmdstr)
}

2
go.mod
查看文件

@ -14,7 +14,7 @@ require (
mvdan.cc/sh/v3 v3.4.3
)
replace mvdan.cc/sh/v3 => github.com/Rosettea/sh/v3 v3.4.0-0.dev.0.20220306140409-795a84b00b4e
replace mvdan.cc/sh/v3 => github.com/Rosettea/sh/v3 v3.4.0-0.dev.0.20211022004519-f67a49cb50f5
replace github.com/maxlandon/readline => github.com/Rosettea/readline-1 v0.0.0-20220305123014-31d4d4214c93

2
go.sum
查看文件

@ -10,8 +10,6 @@ github.com/Rosettea/readline-1 v0.1.0-beta.0.20220228022904-61f5e4493011 h1:+a61
github.com/Rosettea/readline-1 v0.1.0-beta.0.20220228022904-61f5e4493011/go.mod h1:QiUAvbhg8PzCA4hlafCUl0bKD/0VmcocM4AjqtszAJs=
github.com/Rosettea/sh/v3 v3.4.0-0.dev.0.20211022004519-f67a49cb50f5 h1:ygwVRX8gf5MHA0VzSgOdscCEoAJLjM8joEotfQPgAd0=
github.com/Rosettea/sh/v3 v3.4.0-0.dev.0.20211022004519-f67a49cb50f5/go.mod h1:R09vh/04ILvP2Gj8/Z9Jd0Dh0ZIvaucowMEs6abQpWs=
github.com/Rosettea/sh/v3 v3.4.0-0.dev.0.20220306140409-795a84b00b4e h1:P2XupP8SaylWaudD1DqbWtZ3mIa8OsE9635LmR+Q+lg=
github.com/Rosettea/sh/v3 v3.4.0-0.dev.0.20220306140409-795a84b00b4e/go.mod h1:R09vh/04ILvP2Gj8/Z9Jd0Dh0ZIvaucowMEs6abQpWs=
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d h1:licZJFw2RwpHMqeKTCYkitsPqHNxTmd4SNR5r94FGM8=
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d/go.mod h1:asat636LX7Bqt5lYEZ27JNDcqxfjdBQuJ/MM4CN/Lzo=
github.com/blackfireio/osinfo v1.0.3 h1:Yk2t2GTPjBcESv6nDSWZKO87bGMQgO+Hi9OoXPpxX8c=

查看文件

@ -1,12 +1,8 @@
-- We're basically porting Ansikit to lua
-- https://github.com/Luvella/AnsiKit/blob/master/lib/index.js
-- which is made by yours truly sammy :^)
local lunacolors = require 'lunacolors'
local ansikit = {
blockCursor = 1,
blockCursorSteady = 2,
underlineCursor = 3,
underlineCursorSteady = 4,
lineCursor = 5,
lineCursorSteady = 6,
}
local ansikit = {}
ansikit.clear = function(scrollback)
local typ = (scrollback and 3 or 2)

查看文件

@ -172,7 +172,6 @@ input:
if err == io.EOF {
// Exit if user presses ^D (ctrl + d)
hooks.Em.Emit("hilbish.exit")
break
}
if err != nil {

查看文件

@ -45,7 +45,6 @@ commander.register('cd', function (args)
end)
commander.register('exit', function()
bait.throw('hilbish.exit')
os.exit(0)
end)