Add PathFlag

This commit is contained in:
Vladislav Mitov
2017-09-26 15:38:41 +03:00
parent 50a0fdeea6
commit 0b665e6170
13 changed files with 267 additions and 4 deletions

View File

@@ -12,6 +12,7 @@ import (
// MapInputSource implements InputSourceContext to return
// data from the map that is loaded.
type MapInputSource struct {
file string
valueMap map[interface{}]interface{}
}
@@ -39,6 +40,11 @@ func nestedVal(name string, tree map[interface{}]interface{}) (interface{}, bool
return nil, false
}
// Source returns the path of the source file
func (fsm *MapInputSource) Source() string {
return fsm.file
}
// Int returns an int from the map if it exists otherwise returns 0
func (fsm *MapInputSource) Int(name string) (int, error) {
otherGenericValue, exists := fsm.valueMap[name]