func (enc *Encoder) lineBreak(indent int) error {
	_, err := fmt.Fprintf(enc.w, "\n%s", strings.Repeat(" ", indent))
	return err
}
lineBreak writes a line break into the encoder's writer, followed by
the number of indention characters specified by indent.
package yaml
import (
	"fmt"
	"io"
	"reflect"
	"sort"
	"strconv"
	"strings"
	"time"
	"unicode"
	"unicode/utf8"
	"github.com/fatih/color"
	glob "github.com/gobwas/glob"
)
type Colors struct {
	KeyColor     *color.Color
	ValueColor   *color.Color
	CommentColor *color.Color
}
type Encoder struct {
	w              io.Writer
	keyPrinter     func(w io.Writer, format string, a ...interface{})
	commentPrinter func(w io.Writer, format string, a ...interface{})
	dateKeys []glob.Glob
	Colors     *Colors
	indentSize int
}
type EncoderOption func(*Encoder)
func EncoderColors(c *Colors) EncoderOption {
	return func(e *Encoder) { e.Colors = c }
}
func EncoderDateKeys(g []glob.Glob) EncoderOption {
	return func(e *Encoder) { e.dateKeys = g }
}
func EncoderIndent(i int) EncoderOption {
	return func(e *Encoder) { e.indentSize = i }
}
func NewEncoder(w io.Writer, options ...EncoderOption) *Encoder {
	enc := &Encoder{w: w, indentSize: 2}
	for _, opt := range options {
		opt(enc)
	}
	if enc.Colors == nil {
		enc.Colors = &Colors{
			KeyColor:     color.New(),
			ValueColor:   color.New(),
			CommentColor: color.New(),
		}
	}
	return enc
}
func (enc *Encoder) lineBreakV(v reflect.Value, indent int) (int, error) {
	switch v.Kind() {
	case reflect.Interface:
		if v.IsNil() {
			return 0, nil
		}
		return enc.lineBreakV(v.Elem(), indent)
	case reflect.Map:
		if v.Len() > 0 {
			return enc.indentSize, enc.lineBreak(indent + enc.indentSize)
		}
	case reflect.Slice:
		if v.Len() > 0 {
			return 0, enc.lineBreak(indent)
		}
	}
	return 0, nil
}