"i forgot to commit the rest"

This commit is contained in:
JISAUAY 2025-06-30 13:17:57 -05:00
parent c198640510
commit 4add774464
3 changed files with 11 additions and 2 deletions

1
go.mod
View File

@ -3,6 +3,7 @@ module gosh
go 1.21.5 go 1.21.5
require ( require (
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be // indirect
github.com/chzyer/readline v1.5.1 // indirect github.com/chzyer/readline v1.5.1 // indirect
github.com/fatih/color v1.18.0 // indirect github.com/fatih/color v1.18.0 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-colorable v0.1.13 // indirect

2
go.sum
View File

@ -1,3 +1,5 @@
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8=
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be/go.mod h1:ySMOLuWl6zY27l47sB3qLNK6tF2fkHG55UZxx8oIVo4=
github.com/chzyer/logex v1.2.1/go.mod h1:JLbx6lG2kDbNRFnfkgvh4eRJRPX1QCoOIWomwysCBrQ= github.com/chzyer/logex v1.2.1/go.mod h1:JLbx6lG2kDbNRFnfkgvh4eRJRPX1QCoOIWomwysCBrQ=
github.com/chzyer/readline v1.5.1 h1:upd/6fQk4src78LMRzh5vItIt361/o4uq553V8B5sGI= github.com/chzyer/readline v1.5.1 h1:upd/6fQk4src78LMRzh5vItIt361/o4uq553V8B5sGI=
github.com/chzyer/readline v1.5.1/go.mod h1:Eh+b79XXUwfKfcPLepksvw2tcLE/Ct21YObkaSkeBlk= github.com/chzyer/readline v1.5.1/go.mod h1:Eh+b79XXUwfKfcPLepksvw2tcLE/Ct21YObkaSkeBlk=

10
main.go
View File

@ -10,6 +10,7 @@ import (
"path/filepath" "path/filepath"
"strings" "strings"
"github.com/anmitsu/go-shlex"
"github.com/chzyer/readline" "github.com/chzyer/readline"
"github.com/fatih/color" "github.com/fatih/color"
) )
@ -106,7 +107,12 @@ func gosh_process_input(sh *types.Shell, input string) {
for _, cmdStr := range commands { for _, cmdStr := range commands {
cmdStr = strings.TrimSpace(cmdStr) cmdStr = strings.TrimSpace(cmdStr)
parts := strings.Fields(cmdStr) parts, err := shlex.Split(cmdStr, false)
if err != nil {
fmt.Println(err)
}
if len(parts) == 0 { if len(parts) == 0 {
continue continue
} }
@ -157,7 +163,7 @@ func gosh_process_input(sh *types.Shell, input string) {
comd := exec.Command(parts[0], parts[1:]...) comd := exec.Command(parts[0], parts[1:]...)
out, err := comd.Output() out, err := comd.CombinedOutput()
if err != nil { if err != nil {
fmt.Print("Error: ") fmt.Print("Error: ")