wren-lang / wren-cli

A command line tool for the Wren programming language

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Suggestion for additional usage examples

glennj opened this issue · comments

Using the current shell idiom to launch a script with it's interpreter:

$ cat > greet.wren
#!/usr/bin/env wrenc
System.print("Hello World!")

$ wrenc greet.wren
Hello World!

$ chmod u+x greet.wren

$ ./greet.wren
Hello World!

$ cat > args.wren
#!/usr/bin/env wrenc
import "os" for Process
System.print(Process.arguments)
System.print(Process.allArguments)

$ chmod u+x args.wren

$ ./args.wren foo bar baz "with spaces"
[foo, bar, baz, with spaces]
[wrenc, ./args.wren, foo, bar, baz, with spaces]

Luckily the shebang is valid in wren as an annotation

Oops, wrong repo

Please be sure not to confuse the wren-cli and wren-console projects. :-)