util

package
v0.40.4 Latest Latest
Warning

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

Go to latest
Published: May 19, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

This is the Command struct used by the noms utility. It is packaged in a separate util can be used by other programs as well.

This is the Help facility used by the noms utility. It is packaged in a separate util can be used by other programs as well.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckError

func CheckError(err error)

func CheckErrorNoUsage

func CheckErrorNoUsage(err error)

func Help

func Help(args []string)

help implements the 'help' command.

func InitHelp

func InitHelp(name string, cmds []*Command, usage string)

func Usage

func Usage()

Types

type Command

type Command struct {
	// Run runs the command.
	// The args are the arguments after the command name.
	Run func(ctx context.Context, args []string) int

	// UsageLine is the one-line usage message.
	// The first word in the line is taken to be the command name.
	UsageLine string

	// Short is the short description shown in the 'help' output.
	Short string

	// Long is the long message shown in the 'help <this-command>' output.
	Long string

	// Flag is a set of flags specific to this command.
	Flags func() *flag.FlagSet

	// Nargs is the minimum number of arguments expected after flags, specific to this command.
	Nargs int
}

func (*Command) Name

func (nc *Command) Name() string

Name returns the command's name: the first word in the usage line.

func (*Command) Usage

func (nc *Command) Usage()

type KingpinHandler

type KingpinHandler func(input string) (exitCode int)

Jump to

Keyboard shortcuts

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