utils

package
v1.8.10 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckHelpFlag added in v1.8.5

func CheckHelpFlag(output *strings.Builder, usageFunc func()) bool

func HandleCommandOutput added in v1.2.4

func HandleCommandOutput(fn func() (string, error)) func() int

HandleCommandOutput takes a function that returns (string, error) and wraps it in a no-argument function that writes the returned string to stdout if there's no error, or to stderr if there is. It returns an exit code: 0 on success, 1 on error.

func HandleFlagError added in v1.6.1

func HandleFlagError(output *strings.Builder, err error) (string, error)

func LoadGolden

func LoadGolden(t *testing.T, filename string) string

func ValidateArgs added in v1.8.10

func ValidateArgs(args []string, v Validator) error

func ValidatePokemonArgs

func ValidatePokemonArgs(args []string) error

ValidatePokemonArgs validates the command line arguments

func WrapText added in v1.6.1

func WrapText(text string, width int) string

Types

type Validator added in v1.8.10

type Validator struct {
	MaxArgs     int
	CmdName     string
	RequireName bool
	HasFlags    bool
}

Jump to

Keyboard shortcuts

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