consolez

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IconRocket                     = "\U0001F680"
	IconHighVoltage                = "\U000026A1"
	IconBackhandIndexPointingRight = "\U0001F449"
	IconRunner                     = "\U0001F3C3"
	IconCollision                  = "\U0001F4A5"
)

Known icons.

Variables

View Source
var (
	// DefaultCLI is a default, shared instance of CLI.
	DefaultCLI = NewCLI()
)

Functions

func GetColorDefault added in v0.6.0

func GetColorDefault() *color.Color

GetColorDefault returns a color.

func GetColorError added in v0.6.0

func GetColorError() *color.Color

GetColorError returns a color.

func GetColorHighlight added in v0.6.0

func GetColorHighlight() *color.Color

GetColorHighlight returns a color.

func GetColorInfo added in v0.6.0

func GetColorInfo() *color.Color

GetColorInfo returns a color.

func GetColorSecondary added in v0.6.0

func GetColorSecondary() *color.Color

GetColorSecondary returns a color.

func GetColorSecondaryHighlight added in v0.6.0

func GetColorSecondaryHighlight() *color.Color

GetColorSecondaryHighlight returns a color.

func GetColorSuccess added in v0.6.0

func GetColorSuccess() *color.Color

GetColorSuccess returns a color.

func GetColorWarning added in v0.6.0

func GetColorWarning() *color.Color

GetColorWarning returns a color.

Types

type CLI

type CLI struct {
	// contains filtered or unexported fields
}

CLI provides some utilities for printing messages in CLI tools.

func NewCLI

func NewCLI(options ...CLIOption) *CLI

NewCLI initializes a new CLI.

func (*CLI) Banner

func (c *CLI) Banner(title, tagLine string)

Banner prints a banner.

func (*CLI) Command

func (c *CLI) Command(cmd string, params ...string)

Command prints a command.

func (*CLI) Error

func (c *CLI) Error(err error, debug bool)

Error prints an error.

func (*CLI) Header

func (c *CLI) Header(format string, a ...any) func()

Header prints a header based on a nesting hierarchy. Always call the returned function to close the scope, for example by deferring it.

func (*CLI) NewTable

func (c *CLI) NewTable(columnHeaders ...any) table.Table

NewTable creates a new table.

func (*CLI) Notice

func (c *CLI) Notice(scope string, highlight string, secondary ...string)

Notice prints a notice.

func (*CLI) Recover

func (c *CLI) Recover(debug bool)

Recover calls Error on a recovered panic and exits.

func (*CLI) Tool

func (c *CLI) Tool(toolName string, k *kong.Context)

Tool introduces a command line tool.

func (*CLI) WithHeader added in v0.3.0

func (c *CLI) WithHeader(format string, a []any, f func())

WithHeader calls Header and runs f() within its scope.

type CLIOption added in v0.3.0

type CLIOption interface {
	Apply(*CLI)
}

CLIOption describes a CLI option.

type CLIOptionFunc added in v0.3.0

type CLIOptionFunc func(*CLI)

CLIOptionFunc describes a CLI option.

func CLIExit added in v0.3.0

func CLIExit(exit func(code int)) CLIOptionFunc

CLIExit returns a CLI option that allows to provide an alternative implementation for "os.Exit".

func (CLIOptionFunc) Apply added in v0.3.0

func (f CLIOptionFunc) Apply(c *CLI)

Apply implements the CLIOption interface.

type Coverage

type Coverage struct {
	Packages []*gocov.Package
}

Coverage describes collected coverage.

type CoveragePrinter

type CoveragePrinter interface {
	Print(coverage *Coverage)
}

CoveragePrinter implements a printer for test coverage information.

func NewCoveragePrinter

func NewCoveragePrinter() CoveragePrinter

NewCoveragePrinter initializes a new CoveragePrinter.

type GoTestPrinter

type GoTestPrinter interface {
	PrintLine(line string)
	PrintDone()
}

GoTestPrinter implements a printer for "go test" output.

func NewGoTestPrinter

func NewGoTestPrinter() GoTestPrinter

NewGoTestPrinter initializes a new GoTestPrinter.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳