cmd

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrHelpful = errors.New("user needs help")
	ErrNoArgs  = errors.New("no arguments found")
)

Functions

func PrintUsage

func PrintUsage()

Types

type ArgNotFoundError

type ArgNotFoundError string

func (ArgNotFoundError) Error

func (e ArgNotFoundError) Error() string

type ArgParser

type ArgParser func([]string) (Command, error)

type Command

type Command interface {
	Setup() error

	// Run and block until context cancel
	Run(context.Context) error

	// Help by printing a usage string. Currently not used anywhere.
	Help() string

	// Describe the command shortly
	Describe() string

	// Flagset which defines the flags for the command
	Flagset() *flag.FlagSet
}

func Parse

func Parse(args []string) (Command, error)

type UsagePrinter

type UsagePrinter func()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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