mirror of https://github.com/Hilbis/Hilbish
Compare commits
3 Commits
2c2eb8d69a
...
b86912be56
Author | SHA1 | Date |
---|---|---|
sammy | b86912be56 | |
sammy | 4ce223e2f4 | |
sammy | 0afca3d4f6 |
10
lua.go
10
lua.go
|
@ -123,10 +123,14 @@ func hshalias(L *lua.LState) int {
|
||||||
}
|
}
|
||||||
|
|
||||||
func hshappendPath(L *lua.LState) int {
|
func hshappendPath(L *lua.LState) int {
|
||||||
path := L.CheckString(1)
|
dir := L.CheckString(1)
|
||||||
path = strings.Replace(path, "~", curuser.HomeDir, 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
|
return 0
|
||||||
}
|
}
|
||||||
|
|
4
main.go
4
main.go
|
@ -18,7 +18,7 @@ import (
|
||||||
"golang.org/x/term"
|
"golang.org/x/term"
|
||||||
)
|
)
|
||||||
|
|
||||||
var version = "v0.4.1-dev.9"
|
var version = "v0.4.0"
|
||||||
|
|
||||||
var (
|
var (
|
||||||
l *lua.LState
|
l *lua.LState
|
||||||
|
@ -174,7 +174,7 @@ func ContinuePrompt(prev string) (string, error) {
|
||||||
}
|
}
|
||||||
cont = strings.TrimSpace(cont)
|
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)
|
// This semi cursed function formats our prompt (obviously)
|
||||||
|
|
Loading…
Reference in New Issue