remove hidden items

master
Jordan Orelli 10 years ago
parent 510d560552
commit 486c8a8e1d

@ -30,10 +30,8 @@ other_hash: {
key_4: ["five" 6 7.8]
}
item_one: "this is item one"
# we may reference an item that was defined earlier
item_two: item_one
repeat_hash: hash
# items can be hidden. i.e., they're only valid in the parse and eval stage as
# intermediate values internal to the config file; they are *not* visible to

@ -6,6 +6,7 @@ import (
"fmt"
"io"
"os"
"strings"
)
func input(n int) io.ReadCloser {
@ -63,6 +64,11 @@ func eval(r io.Reader) (map[string]interface{}, error) {
if _, err := n.eval(ctx); err != nil {
return nil, fmt.Errorf("eval error: %s\n", err)
}
for name, _ := range ctx {
if strings.HasPrefix(name, ".") {
delete(ctx, name)
}
}
return ctx, nil
}

Loading…
Cancel
Save