Compare commits

..

No commits in common. "4a4cb3409f20ee70f2ea726f6a2fb9a93bb847e1" and "3babf36c438da2da3f886eb1040f11857fd515fc" have entirely different histories.

3 changed files with 2 additions and 18 deletions

View File

@ -69,8 +69,6 @@ func binaryComplete(query, ctx string, fields []string) ([]string, string) {
}
}
completions = removeDupes(completions)
return completions, query
}

View File

@ -9,7 +9,7 @@ import (
"time"
"hilbish/util"
"github.com/yuin/gopher-lua"
"mvdan.cc/sh/v3/shell"
//"github.com/yuin/gopher-lua/parse"
@ -245,7 +245,7 @@ func splitInput(input string) ([]string, string) {
func cmdFinish(code uint8, cmdstr, oldInput string) {
// if input has space at the beginning, dont put in history
if !strings.HasPrefix(oldInput, " ") || interactive {
handleHistory(strings.TrimSpace(oldInput))
handleHistory(cmdstr)
}
util.SetField(l, hshMod, "exitCode", lua.LNumber(code), "Exit code of last exected command")
hooks.Em.Emit("command.exit", code, cmdstr)

14
main.go
View File

@ -187,7 +187,6 @@ input:
input = strings.TrimSpace(input)
if len(input) == 0 {
running = true
hooks.Em.Emit("command.exit", 0)
continue
}
@ -269,16 +268,3 @@ func expandHome(path string) string {
return strings.Replace(defaultHistDir, "~", homedir, 1)
}
func removeDupes(slice []string) []string {
all := make(map[string]bool)
newSlice := []string{}
for _, item := range slice {
if _, val := all[item]; !val {
all[item] = true
newSlice = append(newSlice, item)
}
}
return newSlice
}