string_format_writer

package
v0.0.0-...-32d88a2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 8, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StringDRArrow         = "↳"
	StringNew             = "new"
	StringSame            = "same"
	StringChanged         = "changed"
	StringDeleted         = "deleted"
	StringUpdated         = "updated"
	StringArchived        = "archived"
	StringInternal        = "internal"
	StringUnchanged       = "unchanged"
	StringUntracked       = "untracked"
	StringConflicted      = "conflicted"
	StringRecognized      = "recognized"
	StringCheckedOut      = "checked out"
	StringBlobMissing     = "blob missing"
	StringWouldDelete     = "would delete"
	StringUnrecognized    = "unrecognized"
	StringFormatDateTime  = "06-01-02 15:04:05"
	StringIndent          = "                 "
	StringIndentWithSpace = "                   "
	LenStringMax          = len(StringIndent) // TODO-P4 use reflection?

	ColorTypeNormal   = ColorType(colorNone)
	ColorTypeId       = ColorType(colorBlue)
	ColorTypeHash     = ColorType(colorItalic)
	ColorTypeError    = ColorType(colorRed)
	ColorTypeType     = ColorType(colorYellow)
	ColorTypeUserData = ColorType(colorCyan)
	ColorTypeHeading  = ColorType(colorRed)
)
View Source
const (
	CliFormatTruncationNone = CliFormatTruncation(iota)
	CliFormatTruncation66CharEllipsis
)

Variables

This section is empty.

Functions

func MakeBracketWrapped

func MakeBracketWrapped[T any](
	sfw interfaces.StringFormatWriter[T],
) interfaces.StringFormatWriter[T]

func MakeCliFormatFields

func MakeCliFormatFields(
	truncate CliFormatTruncation,
	co ColorOptions,
) *fieldsWriter

func MakeDefaultDatePrefixFormatWriter

func MakeDefaultDatePrefixFormatWriter[T any](
	clock Clock,
	f interfaces.StringFormatWriter[T],
) interfaces.StringFormatWriter[T]

func MakeDelim

func MakeDelim[T any](
	delim string,
	w1 interfaces.WriterAndStringWriter,
	f interfaces.StringFormatWriter[T],
) func(T) error

func MakeQuotedString

func MakeQuotedString[T ~string]() interfaces.StringFormatWriter[T]

func MakeRightAligned

func MakeRightAligned() interfaces.StringFormatWriter[string]

func MakeString

func MakeString[T ~string]() interfaces.StringFormatWriter[T]

func StringPrefixFromOptions

func StringPrefixFromOptions(
	options options_print.V0,
) string

func WriteStringPrefixFormat

func WriteStringPrefixFormat(
	w interfaces.WriterAndStringWriter,
	prefix, body string,
) (n int64, err error)

Types

type Box

type Box struct {
	Header                   BoxHeader
	Contents                 []Field
	Trailer                  []Field
	EachFieldOnANewline      bool
	IdFieldsSeparatedByLines bool
}

type BoxHeader

type BoxHeader struct {
	Value        string
	RightAligned bool
}

type CliFormatTruncation

type CliFormatTruncation int

type Clock

type Clock interface {
	GetTime() time.Time
}

type ColorOptions

type ColorOptions struct {
	OffEntirely bool
}

func (ColorOptions) SetOffEntirely

func (co ColorOptions) SetOffEntirely(v bool) ColorOptions

type ColorType

type ColorType string

type Date

type Date[T any] struct {
	Clock
	Format string
	interfaces.StringFormatWriter[T]
}

func (*Date[T]) WriteStringFormat

func (f *Date[T]) WriteStringFormat(
	w interfaces.WriterAndStringWriter,
	e T,
) (n int64, err error)

type Field

type Field struct {
	ColorType
	Separator          rune
	Key, Value         string
	DisableValueQuotes bool
	NoTruncate         bool
	NeedsNewline       bool
}

type HeaderWriter

type HeaderWriter[T any] interface {
	WriteBoxHeader(*BoxHeader, T) error
}

type OutputOptions

type OutputOptions struct {
	ColorOptionsOut ColorOptions
	ColorOptionsErr ColorOptions
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL