cmd

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2025 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoArgs = errors.New("no arguments found")

Functions

func Run added in v1.0.1

func Run(ctx context.Context, args []string, commands map[string]Command, usage string) int

Types

type ArgNotFoundError

type ArgNotFoundError string

func (ArgNotFoundError) Error

func (e ArgNotFoundError) Error() string

type ArgParser

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

type Command

type Command interface {
	Setup(context.Context) 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
}

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