mirror of https://github.com/Hilbis/Hilbish
feat: cd builtin
parent
e6d625012d
commit
9c08954c2f
16
main.go
16
main.go
|
@ -66,14 +66,16 @@ 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
|
||||
|
||||
cmd := exec.Command(cmdArgs[0], cmdArgs[1:]...)
|
||||
cmd.Stderr = os.Stderr
|
||||
cmd.Stdout = os.Stdout
|
||||
|
||||
if err := cmd.Run(); err != nil {
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
if err := cmd.Run(); err != nil {
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
}
|
||||
}
|
||||
readline.AddHistory(cmdString)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue