diff --git a/cmd/warrend/.main.go.swo b/cmd/warrend/.main.go.swo new file mode 100644 index 0000000..813b891 Binary files /dev/null and b/cmd/warrend/.main.go.swo differ diff --git a/cmd/warrend/main.go b/cmd/warrend/main.go index ba112ac..4639a58 100644 --- a/cmd/warrend/main.go +++ b/cmd/warrend/main.go @@ -7,6 +7,7 @@ import ( "net" "os" "os/signal" + "strings" "syscall" ) @@ -37,8 +38,18 @@ func sockCmdHandle(c net.Conn) { } fmt.Println("cmdHandle got command:", string(data)) + // BAD: TODO: handle quotes " + var args = strings.Split(" ", data) + // parse args + var icmd = warren.GetCommand(args[0]) // get and run cmd + if icmd == nil { + c.Write([]byte("Unknown command " + args[0])) + // usage ? + return + } + icmd.(*SockCommand).Exec(c, args[1:]) c.Write([]byte("echo: " + data)) }