func Parse(input string, patterns []string, caseSensitive bool, noColor bool) {
	const Separator = "FIELDS:"
	const TabLength = 3
	start := getIndex(input, Separator)
	if start == -1 {
		fmt.Println(input)
		return
	}
	data := input[start+len(Separator):]
	const Trash = string(9) + "|" + `<[^>]*>|\n`
	data = findAndDelete(data, Trash)
	var spaces []int
	var fields []string
	spaces, fields = analyze(data)
	var hierarchy string
	var index int
	r := regexp.MustCompile(`(?i)` + strings.Join(patterns, "|"))
	if caseSensitive {
		r = regexp.MustCompile(strings.Join(patterns, "|"))
	}
	for i := 0; i < len(fields); i++ {
		if r.FindString(fields[i]) != "" {
			hierarchy = fields[i]
			index = i
			for index != -1 {
				index = findParentIndex(spaces, index, TabLength)
				if index != -1 {
					hierarchy = fields[index] + "." + hierarchy
				}
			}
			if noColor {
				fmt.Println(hierarchy)
			} else {
				color.Fill(hierarchy, r)
			}
		}
	}
}
Parse function parses given input and prints one liner hierarchy structures
/*
input: Expects kubectl explain --recursive output
patterns: Hierarchy to be computed for given patterns
caseSensitive: Case sensitive pattern match
noColor: If set, it won't print the colored output
package fields
import (
	"fmt"
	"github.com/rewanth1997/kubectl-fields/pkg/color"
	"regexp"
	"strings"
)
func analyze(data string) ([]int, []string) {
	var spaces []int
	var fields []string
	counter := 0
	substring := ""
	for i := 0; i < len(data); i++ {
		if data[i] == 32 {
			if substring != "" {
				spaces = append(spaces, counter)
				fields = append(fields, substring)
				substring = ""
				counter = 0
			}
			counter++
		} else {
			substring += string(data[i])
		}
	}
	spaces = append(spaces, counter)
	fields = append(fields, substring)
	return spaces, fields
}
func getIndex(data string, substring string) int {
	return strings.Index(data, substring)
}
func findAndDelete(data string, regex string) string {
	var re = regexp.MustCompile(regex)
	return re.ReplaceAllString(data, "")
}
func findParentIndex(spaces []int, index int, tabLength int) int {
	for i := index - 1; i >= 0; i-- {
		if spaces[i] == spaces[index]-tabLength {
			return i
		}
	}
	return -1
}