Super-simple command-line arguments parser for Wren.
import "args" for Args
var args = Args.parse()
if (args["special-mode"]) System.print("Special mode activated!")
Parses a list of strings like Process.arguments
.
Args.parse([ "lone", "-dc", "--with", "value" ]) = [
{
// 'true' denotes the arguments were provided, but had no value assigned.
"d": true,
"c": true,
// Note that all argument values are returned as Strings. Use Num.fromString
// to obtain number values, if required.
"with": "value"
},
// Lone values. These are values that had no preceeding argument name before them.
[ "lone" ]
]
Calls Args.parse(args)
with Process.arguments
.