feat: use lua to retrieve readline history

lua-history
TorchedSammy 2022-07-09 15:25:11 -04:00
parent 25c1d2ee2f
commit 9c91e6ee51
Signed by: sammyette
GPG Key ID: 904FC49417B44DCD
2 changed files with 2 additions and 2 deletions

View File

@ -116,8 +116,8 @@ func main() {
} }
go handleSignals() go handleSignals()
luaInit()
lr = newLineReader("", false) lr = newLineReader("", false)
luaInit()
// If user's config doesn't exixt, // If user's config doesn't exixt,
if _, err := os.Stat(defaultConfPath); os.IsNotExist(err) && *configflag == defaultConfPath { if _, err := os.Stat(defaultConfPath); os.IsNotExist(err) && *configflag == defaultConfPath {
// Read default from current directory // Read default from current directory

2
rl.go
View File

@ -28,7 +28,7 @@ func newLineReader(prompt string, noHist bool) *lineReader {
// but it cant have shared history // but it cant have shared history
if !noHist { if !noHist {
lr.fileHist = newFileHistory(defaultHistPath) lr.fileHist = newFileHistory(defaultHistPath)
rl.SetHistoryCtrlR("History", lr.fileHist) rl.SetHistoryCtrlR("History", &luaHistory{})
rl.HistoryAutoWrite = false rl.HistoryAutoWrite = false
} }
rl.ShowVimMode = false rl.ShowVimMode = false