mirror of https://github.com/Hilbis/Hilbish
feat: cd builtin
parent
e6d625012d
commit
9c08954c2f
6
main.go
6
main.go
|
@ -66,8 +66,9 @@ func main() {
|
|||
switch cmdArgs[0] {
|
||||
case "exit":
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
case "cd":
|
||||
os.Chdir(strings.Trim(cmdString, "cd "))
|
||||
default:
|
||||
cmd := exec.Command(cmdArgs[0], cmdArgs[1:]...)
|
||||
cmd.Stderr = os.Stderr
|
||||
cmd.Stdout = os.Stdout
|
||||
|
@ -75,6 +76,7 @@ func main() {
|
|||
if err := cmd.Run(); err != nil {
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
}
|
||||
}
|
||||
readline.AddHistory(cmdString)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue