command

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultShortUsage

func DefaultShortUsage(c *Command) string

func DefaultUsage

func DefaultUsage(c *Command) string

Types

type Command

type Command struct {
	Name       string
	ShortHelp  string
	ShortUsage string
	LongHelp   string

	Flags *flag.FlagSet
	Exec  func(ctx context.Context, args []string) error

	Subcommands []*Command
	// contains filtered or unexported fields
}

func DefaultVersionCommand

func DefaultVersionCommand(stdout io.Writer) *Command

func (*Command) Parse

func (cmd *Command) Parse(args []string, options ...ParseOption) error

func (*Command) Run

func (cmd *Command) Run(ctx context.Context) (err error)

type ParseOption

type ParseOption func(*ParseOptions) error

func WithEnvVarPrefix

func WithEnvVarPrefix(prefix string) ParseOption

func WithEnvVars

func WithEnvVars() ParseOption

type ParseOptions

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

type VersionInfo

type VersionInfo interface {
	// The version number
	Version() string

	// The revision identifier of the commit
	Revision() string

	// The modification time of the commit, in RFC3339 format
	Time() string

	// Whether the source tree had uncommitted local changes
	Modified() bool

	// The version of the Go toolchain that built the binary
	GoVersion() string
}

func DefaultVersionInfo

func DefaultVersionInfo() VersionInfo

Jump to

Keyboard shortcuts

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