helper

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: MIT Imports: 9 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FlagTypeFromVariations

func FlagTypeFromVariations(variations map[string]*any) (model.FlagType, error)

func LegacyWarner

func LegacyWarner() *legacy.Warner

LegacyWarner returns the Warner of a CLI command: the use of a legacy name is logged once, through the default logger of the process.

func LegacyWarnerTo

func LegacyWarnerTo(logger func() *slog.Logger) *legacy.Warner

LegacyWarnerTo is LegacyWarner with the logger it writes to: logger is called for every warning, so a default logger replaced after the warner was built is still honoured.

func PrintFatal

func PrintFatal(printer *pterm.PrefixPrinter, exit func(int), err error)

PrintFatal prints err with printer, then calls exit with the code 1. The printer and the exit function are parameters so that the callers that must not stop the process (tests) can pass their own.

func PrintFatalAndExit

func PrintFatalAndExit(err error)

PrintFatalAndExit prints err as an error and exits the process with the code 1.

Types

type Level

type Level = string
const (
	WarnLevel    Level = "WARNING"
	InfoLevel    Level = "INFO"
	ErrorLevel   Level = "ERROR"
	DefaultLevel Level = "DEFAULT"
)

type Output

type Output struct {
	Lines []OutputLine
}

func (*Output) Add

func (o *Output) Add(line string, level Level) Output

func (*Output) PrintLines

func (o *Output) PrintLines(cmd *cobra.Command)

type OutputLine

type OutputLine struct {
	Text  string
	Level Level
}

Jump to

Keyboard shortcuts

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