all: handle optional args more gracefully

This commit is contained in:
2018-05-14 21:55:10 +02:00
parent ac880c26a6
commit 4be6927dc2
2 changed files with 12 additions and 4 deletions

View File

@@ -282,7 +282,7 @@ func evalFn(input []*ast.AST, e ast.Env) (*ast.AST, error) {
return nil, fmt.Errorf("Argument list cannot contain %s", a.Pretty())
}
if argvln == 2 {
opt.Set(argv[1].Val.(string), nil)
opt.Set(argv[1].Val.(string), &nilVal)
} else if argvln == 3 {
opt.Set(argv[1].Val.(string), argv[2])
}