wahat
Jes Olson j3s@c3f.net
Sun, 26 Mar 2023 14:10:51 -0700
2 files changed,
15 insertions(+),
3 deletions(-)
M
shell/shell.go
→
shell/shell.go
@@ -17,13 +17,24 @@ "mvdan.cc/sh/v3/syntax"
) func Run(r *interp.Runner, script string) { + color.ZoaSay("zoa runs :3") f, err := parseFile(script) if err != nil { log.Fatal(err) } ctx := context.TODO() + fmt.Printf("f stmts: %+v\n", f.Stmts) for _, stmt := range f.Stmts { // 14:8 + fmt.Printf("stmt: %T %+v\n", stmt.Cmd, stmt.Cmd) + switch stmt.Cmd.(type) { + case *syntax.CallExpr: + var thing *syntax.CallExpr + thing = stmt.Cmd.(*syntax.CallExpr) + for _, a := range thing.Args { + fmt.Printf("thing: %s\n", a) + } + } pos := stmt.Pos() ctx = context.WithValue(ctx, "position", pos) err = r.Run(ctx, stmt)@@ -42,7 +53,7 @@ fmt.Println()
// shell tips go here if command == "echo" { color.ZoaSay(`prefer printf over echo! -ex: printf '%s\n' "hello world!"`) +ex: printf '%s\n' 'hello world!'`) } fmt.Printf("$ %s\n", strings.Join(args, " "))