func OutputFromString(s string) Output {
	switch strings.ToLower(s) {
	case "json", "j":
		return OutputJSON
	case "yaml", "y":
		return OutputYAML
	default:
		return OutputInvalid
	}
}
OutputFromString converts a string to Output
package ycat
import (
	"bytes"
	"encoding/json"
	"io"
	"os"
	"path"
	"strings"
	yaml "gopkg.in/yaml.v2"
)
type Format uint
const (
	Auto Format = iota
	YAML
	JSON
	JSONNET
)
func FormatFromString(s string) Format {
	switch strings.ToLower(s) {
	case "json", "j":
		return JSON
	case "yaml", "y":
		return YAML
	default:
		return Auto
	}
}
const EnvDefaultFormat = "YCAT_FORMAT"
const EnvDefaultOutput = "YCAT_OUTPUT"
var (
	defaultFormat = Auto
	defaultOutput = OutputInvalid
)
func DefaultFormat() Format {
	if defaultFormat == Auto {
		f := FormatFromString(os.Getenv(EnvDefaultFormat))
		switch f {
		case YAML, JSON:
			defaultFormat = f
		default:
			defaultFormat = YAML
		}
	}
	return defaultFormat
}
func DefaultOutput() Output {
	if defaultOutput == OutputInvalid {
		f := OutputFromString(os.Getenv(EnvDefaultOutput))
		switch f {
		case OutputYAML, OutputJSON:
			defaultOutput = f
		default:
			defaultOutput = OutputYAML
		}
	}
	return defaultOutput
}
func DetectFormat(filename string) Format {
	switch path.Ext(filename) {
	case ".json":
		return JSON
	case ".jsonnet":
		return JSONNET
	case ".yaml", ".yml":
		return YAML
	default:
		return DefaultFormat()
	}
}
type Output int
const (
	OutputInvalid Output = iota
	OutputYAML
	OutputJSON
)