func()

in terraform/terraform.go [222:246]


func (b Blocks) Search(q, field string) Blocks {
	result := Blocks{}

	for _, v := range b {
		switch field {
		case "type":
			if strings.Contains(v.Type, q) {
				result = append(result, v)
			}
		case "name":
			if strings.Contains(v.Name, q) {
				result = append(result, v)
			}
		case "kind":
			if strings.Contains(v.Kind, q) {
				result = append(result, v)
			}
		case "file":
			if strings.Contains(v.File, q) {
				result = append(result, v)
			}
		}
	}
	return result
}