cmd

package
v2.0.2-alpha Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var OsExiter = os.Exit

OsExiter is the function used when the app exits. If not set defaults to os.Exit.

Functions

func NewCLIError

func NewCLIError(cause error, printers ...Printer) error

func Run

func Run(
	stdin ReadWriterWithStat,
	stdout ReadWriterWithStat,
	stderr ReadWriterWithStat,

	osArgs []string,

	release Release,
)

Types

type CLI

type CLI struct {
	Stdin  ReadWriterWithStat
	Stdout ReadWriterWithStat
	Stderr ReadWriterWithStat

	OsArgs []string

	Release Release
	// contains filtered or unexported fields
}

func (*CLI) Execute

func (cli *CLI) Execute()

func (*CLI) Init

func (cli *CLI) Init() error

func (CLI) PrintErr

func (cli CLI) PrintErr(err error)

func (CLI) PrintWarn

func (cli CLI) PrintWarn(err error)

type CLIError

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

func (CLIError) Error

func (e CLIError) Error() string

func (CLIError) PrintDetails

func (e CLIError) PrintDetails(w io.Writer)

type Config

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

type FlagString

type FlagString string

func (*FlagString) Scan

func (a *FlagString) Scan(state fmt.ScanState, verb rune) error

type Printer

type Printer interface {
	Print(w io.Writer)
}

func CodeBlock

func CodeBlock(code string) Printer

func ColoredBox

func ColoredBox(prefix string, text string) Printer

func Paragraph

func Paragraph(text string) Printer

type ReadWriterWithStat

type ReadWriterWithStat interface {
	io.ReadWriter

	Stat() (fs.FileInfo, error)
}

type Release

type Release struct {
	// Current Git tag (the v prefix is stripped)
	Version string

	// Current git commit SHA
	Commit string

	// Date in the RFC3339 format
	Date string
}

Release holds the information (from the 3 ldflags) that goreleaser sets.

Jump to

Keyboard shortcuts

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