mirror of https://github.com/Hilbis/Hilbish
Compare commits
No commits in common. "4a4cb3409f20ee70f2ea726f6a2fb9a93bb847e1" and "3babf36c438da2da3f886eb1040f11857fd515fc" have entirely different histories.
4a4cb3409f
...
3babf36c43
|
@ -69,8 +69,6 @@ func binaryComplete(query, ctx string, fields []string) ([]string, string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
completions = removeDupes(completions)
|
|
||||||
|
|
||||||
return completions, query
|
return completions, query
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
4
exec.go
4
exec.go
|
@ -9,7 +9,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"hilbish/util"
|
"hilbish/util"
|
||||||
|
|
||||||
"github.com/yuin/gopher-lua"
|
"github.com/yuin/gopher-lua"
|
||||||
"mvdan.cc/sh/v3/shell"
|
"mvdan.cc/sh/v3/shell"
|
||||||
//"github.com/yuin/gopher-lua/parse"
|
//"github.com/yuin/gopher-lua/parse"
|
||||||
|
@ -245,7 +245,7 @@ func splitInput(input string) ([]string, string) {
|
||||||
func cmdFinish(code uint8, cmdstr, oldInput string) {
|
func cmdFinish(code uint8, cmdstr, oldInput string) {
|
||||||
// if input has space at the beginning, dont put in history
|
// if input has space at the beginning, dont put in history
|
||||||
if !strings.HasPrefix(oldInput, " ") || interactive {
|
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")
|
util.SetField(l, hshMod, "exitCode", lua.LNumber(code), "Exit code of last exected command")
|
||||||
hooks.Em.Emit("command.exit", code, cmdstr)
|
hooks.Em.Emit("command.exit", code, cmdstr)
|
||||||
|
|
14
main.go
14
main.go
|
@ -187,7 +187,6 @@ input:
|
||||||
|
|
||||||
input = strings.TrimSpace(input)
|
input = strings.TrimSpace(input)
|
||||||
if len(input) == 0 {
|
if len(input) == 0 {
|
||||||
running = true
|
|
||||||
hooks.Em.Emit("command.exit", 0)
|
hooks.Em.Emit("command.exit", 0)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -269,16 +268,3 @@ func expandHome(path string) string {
|
||||||
|
|
||||||
return strings.Replace(defaultHistDir, "~", homedir, 1)
|
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
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue