mirror of
https://github.com/hashicorp/packer.git
synced 2026-09-26 17:53:59 -04:00
add kvfilter type that regroups very frequently used filters
This commit is contained in:
@@ -6,3 +6,19 @@ type KeyValue struct {
|
||||
Key string
|
||||
Value string
|
||||
}
|
||||
|
||||
type KVFilter struct {
|
||||
Filters map[string]string
|
||||
Filter []KeyValue
|
||||
}
|
||||
|
||||
func (kvf *KVFilter) Prepare() error {
|
||||
for _, filter := range kvf.Filter {
|
||||
kvf.Filters[filter.Key] = filter.Value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (kvf *KVFilter) Empty() bool {
|
||||
return len(kvf.Filters) == 0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user