|
// retoor <retoor@molodetz.nl>
|
|
|
|
import "argparse" for ArgumentParser
|
|
|
|
var parser = ArgumentParser.new()
|
|
parser.addArgument("filename")
|
|
parser.addArgument("output", {"required": false, "default": "out.txt"})
|
|
|
|
var args = parser.parseArgs(["input.txt"])
|
|
System.print(args["filename"]) // expect: input.txt
|
|
System.print(args["output"]) // expect: out.txt
|
|
|
|
var args2 = parser.parseArgs(["input.txt", "result.txt"])
|
|
System.print(args2["filename"]) // expect: input.txt
|
|
System.print(args2["output"]) // expect: result.txt
|