small pixel drawing of a pufferfish zoa

wahat
Jes Olson j3s@c3f.net
Sun, 26 Mar 2023 14:10:51 -0700
commit

6f58d51223ab0ee1865fe9a96188a8629d545d9a

parent

99cfefbc95c9fba60bcef86f888199b71e39bcfd

2 files changed, 15 insertions(+), 3 deletions(-)

jump to
M shell/shell.goshell/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, " "))
M test/maintest/main

@@ -25,6 +25,7 @@ fi

# test zoa cp zoa cp /tmp/hi /tmp/hi2 0644 +rm /tmp/hi2 /tmp/hi -# should pass -ls /asdfnoexist || true +# fail on purpose +ls /noexist