output

package
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const JSONPretty = "json-pretty"
View Source
const Unchecked = ""

Variables

View Source
var Checkmark = pterm.Green("✓")

Functions

func FormatTime

func FormatTime(ts *time.Time) string

func GetValidInput added in v0.0.6

func GetValidInput[T any](ctx context.Context, initialValue string, validator Validator[T]) (T, error)

func MakeJSON added in v0.0.13

func MakeJSON(ctx context.Context, out interface{}, pretty bool) ([]byte, error)

func MakeJSONFromInterface added in v0.0.13

func MakeJSONFromInterface(ctx context.Context, data interface{}, pretty bool) ([]byte, error)

func MakeJSONFromProto added in v0.0.13

func MakeJSONFromProto(ctx context.Context, m proto.Message, pretty bool) ([]byte, error)

func WithTransposeTable added in v0.0.7

func WithTransposeTable() outputOption

Types

type Manager

type Manager interface {
	Output(ctx context.Context, out interface{}, opts ...outputOption) error
}

func NewManager

func NewManager(ctx context.Context, v *viper.Viper) Manager

type PreText

type PreText interface {
	Pretext() string
}

type TablePrint

type TablePrint interface {
	Header() []string
	Rows() [][]string
}

type TableSort added in v0.0.6

type TableSort interface {
	// Columns to sort by ordered by priority.
	OrderedSortColumns() []string
}

type Validator added in v0.0.6

type Validator[T any] interface {
	IsValid(txt string) (T, bool)
	Prompt(isFirstRun bool)
}

type WideTablePrint added in v0.0.6

type WideTablePrint interface {
	WideHeader() []string
	WideRows() [][]string
}

Jump to

Keyboard shortcuts

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