format

package
v0.48.3 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Format

type Format string

Format is an output format such as json or xml.

const (
	Text     Format = "text"
	JSON     Format = "json"
	JSONL    Format = "jsonl"
	JSONA    Format = "jsona"
	HTML     Format = "html"
	Markdown Format = "markdown"
	XLSX     Format = "xlsx"
	XML      Format = "xml"
	CSV      Format = "csv"
	TSV      Format = "tsv"
	Raw      Format = "raw"
	YAML     Format = "yaml"
)

Output format values.

func All

func All() []Format

All returns a new slice containing all format.Format values.

func (Format) String

func (f Format) String() string

String returns the format value.

func (*Format) UnmarshalText

func (f *Format) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

type Opt added in v0.36.0

type Opt struct {
	options.BaseOpt
	// contains filtered or unexported fields
}

Opt is an options.Opt for format.Format.

func NewOpt added in v0.36.0

func NewOpt(key string, flag *options.Flag, defaultVal Format,
	validFn func(Format) error, usage, help string,
) Opt

NewOpt returns a new format.Opt instance. If validFn is non-nil, it is executed against possible values.

func (Opt) Default added in v0.47.0

func (op Opt) Default() Format

Default returns the default value of op.

func (Opt) DefaultAny added in v0.36.0

func (op Opt) DefaultAny() any

DefaultAny implements options.Opt.

func (Opt) Get added in v0.36.0

func (op Opt) Get(o options.Options) Format

Get returns op's value in o. If o is nil, or no value is set, op's default value is returned.

func (Opt) GetAny added in v0.36.0

func (op Opt) GetAny(o options.Options) any

GetAny implements options.Opt.

func (Opt) Process added in v0.36.0

func (op Opt) Process(o options.Options) (options.Options, error)

Process implements options.Processor. It converts matching string values in o into format.Format. If no match found, the input arg is returned unchanged. Otherwise, a clone is returned.

Jump to

Keyboard shortcuts

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