github.com/wikibal01/hashicorp-terraform@v0.11.12-beta1/helper/variables/flag_any.go (about) 1 package variables 2 3 import ( 4 "strings" 5 ) 6 7 // FlagAny is a flag.Value for parsing user variables in the format of 8 // 'key=value' OR a file path. 'key=value' is assumed if '=' is in the value. 9 // You cannot use a file path that contains an '='. 10 type FlagAny map[string]interface{} 11 12 func (v *FlagAny) String() string { 13 return "" 14 } 15 16 func (v *FlagAny) Set(raw string) error { 17 idx := strings.Index(raw, "=") 18 if idx >= 0 { 19 flag := (*Flag)(v) 20 return flag.Set(raw) 21 } 22 23 flag := (*FlagFile)(v) 24 return flag.Set(raw) 25 }