feat: replace /home/sammy with $HOME

pull/5/head
TorchedSammy 2021-03-21 02:43:20 -04:00
parent 22d744bd59
commit 8234f7b497
1 changed files with 3 additions and 1 deletions

View File

@ -19,7 +19,7 @@ import (
"layeh.com/gopher-luar" "layeh.com/gopher-luar"
) )
const version = "0.0.6" const version = "0.0.8"
var l *lua.LState var l *lua.LState
var prompt string var prompt string
var commands = map[string]bool{} var commands = map[string]bool{}
@ -77,6 +77,8 @@ func main() {
quoted = !quoted quoted = !quoted
// dont add back quotes // dont add back quotes
//sb.WriteRune(r) //sb.WriteRune(r)
} else if r == '~' {
sb.WriteString(os.Getenv("HOME"))
} else if !quoted && r == ' ' { } else if !quoted && r == ' ' {
cmdArgs = append(cmdArgs, sb.String()) cmdArgs = append(cmdArgs, sb.String())
sb.Reset() sb.Reset()