util

package
v0.0.0-...-d6cb97c Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2018 License: Apache-2.0 Imports: 8 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 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(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 KingpinCommand

type KingpinCommand func(*kingpin.Application) (*kingpin.CmdClause, KingpinHandler)

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