func isK8sPathProvided()

in cost-optimization/gke-shift-left-cost/main.go [124:137]


func isK8sPathProvided(k8sPath string, flag string) bool {
	if k8sPath == "" {
		return false
	}

	f, err := os.Stat(k8sPath)
	if os.IsNotExist(err) {
		exit(fmt.Sprintf("%s provided does not exists", flag))
	}
	if !(f.IsDir() || strings.HasSuffix(f.Name(), ".yaml") || strings.HasSuffix(f.Name(), ".yml")) {
		exit(fmt.Sprintf("%s provided must be a folder or a yaml file", flag))
	}
	return true
}