mirror of https://github.com/Hilbis/Hilbish
feat: switch to hilbiline
parent
885c54ed3f
commit
2089d71ed2
15
main.go
15
main.go
|
@ -11,6 +11,7 @@ import (
|
||||||
|
|
||||||
"github.com/akamensky/argparse"
|
"github.com/akamensky/argparse"
|
||||||
"github.com/bobappleyard/readline"
|
"github.com/bobappleyard/readline"
|
||||||
|
"github.com/Hilbis/Hilbiline"
|
||||||
"github.com/yuin/gopher-lua"
|
"github.com/yuin/gopher-lua"
|
||||||
"golang.org/x/term"
|
"golang.org/x/term"
|
||||||
)
|
)
|
||||||
|
@ -91,12 +92,14 @@ func main() {
|
||||||
go HandleSignals()
|
go HandleSignals()
|
||||||
LuaInit(*configflag)
|
LuaInit(*configflag)
|
||||||
|
|
||||||
readline.Completer = readline.FilenameCompleter
|
hl := hilbiline.New(prompt)
|
||||||
readline.LoadHistory(homedir + "/.hilbish-history")
|
//readline.Completer = readline.FilenameCompleter
|
||||||
|
//readline.LoadHistory(homedir + "/.hilbish-history")
|
||||||
|
|
||||||
for {
|
for {
|
||||||
running = false
|
running = false
|
||||||
input, err := readline.String(fmtPrompt())
|
hl.SetPrompt(fmtPrompt())
|
||||||
|
input, err := hl.Read()
|
||||||
if err == io.EOF {
|
if err == io.EOF {
|
||||||
// Exit if user presses ^D (ctrl + d)
|
// Exit if user presses ^D (ctrl + d)
|
||||||
fmt.Println("")
|
fmt.Println("")
|
||||||
|
@ -170,9 +173,9 @@ func HandleSignals() {
|
||||||
|
|
||||||
for range c {
|
for range c {
|
||||||
if !running {
|
if !running {
|
||||||
fmt.Println(" // interrupt")
|
//fmt.Println(" // interrupt")
|
||||||
readline.ReplaceLine("", 0)
|
//readline.ReplaceLine("", 0)
|
||||||
readline.RefreshLine()
|
//readline.RefreshLine()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue