Compare commits

..

3 Commits

Author SHA1 Message Date
sammy b86912be56
chore: change default version to be latest release 2021-05-15 23:13:15 -04:00
sammy 4ce223e2f4
fix: dont make continued input spaced out
basically, if i had something like
> here i want to \
complete
it would return "here i want to  complete"
so now it doesnt anymore, if you want the space, do it manually
2021-05-15 22:25:29 -04:00
sammy 0afca3d4f6
fix: dont append to path if dir is already there (resolves #52) 2021-05-15 22:23:21 -04:00
2 changed files with 9 additions and 5 deletions

10
lua.go
View File

@ -123,10 +123,14 @@ func hshalias(L *lua.LState) int {
}
func hshappendPath(L *lua.LState) int {
path := L.CheckString(1)
path = strings.Replace(path, "~", curuser.HomeDir, 1)
dir := L.CheckString(1)
dir = strings.Replace(dir, "~", curuser.HomeDir, 1)
pathenv := os.Getenv("PATH")
os.Setenv("PATH", os.Getenv("PATH") + ":" + path)
// if dir isnt already in $PATH, add it
if !strings.Contains(pathenv, dir) {
os.Setenv("PATH", pathenv + ":" + dir)
}
return 0
}

View File

@ -18,7 +18,7 @@ import (
"golang.org/x/term"
)
var version = "v0.4.1-dev.9"
var version = "v0.4.0"
var (
l *lua.LState
@ -174,7 +174,7 @@ func ContinuePrompt(prev string) (string, error) {
}
cont = strings.TrimSpace(cont)
return prev + " " + strings.TrimSuffix(cont, "\n"), nil
return prev + strings.TrimSuffix(cont, "\n"), nil
}
// This semi cursed function formats our prompt (obviously)