cli

package
v3.0.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Flag

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

Flag is used for cli parameters.

func NewFlag

func NewFlag(name string) *Flag

NewFlag returns a new flag with provided flag name.

func (*Flag) BoolVarF

func (f *Flag) BoolVarF(ptr *bool, name string, shortName string, value bool, usage string)

BoolVarF defines 2 bool flags with specified name and shortName, default value, and usage string. The argument ptr points to a bool variable in which to store the value of the flag.

func (*Flag) Format

func (f *Flag) Format() []string

Format function formats Flag f for cli display.

func (*Flag) IntVarF

func (f *Flag) IntVarF(ptr *int, name string, shortName string, value int, usage string)

IntVarF defines 2 int flags for specified name and shortName with default value, and usage string. The argument ptr points to an int variable in which to store the value of the flag.

func (*Flag) ParseFlags

func (f *Flag) ParseFlags()

ParseFlags parses flag definitions from the command line, which should not include the command name. Must be called after all flags in the FlagSet are defined and before flags are accessed by the program. The return value will be ErrHelp if -help or -h were set but not defined.

func (*Flag) StringVarF

func (f *Flag) StringVarF(ptr *string, name string, shortName string, value string, usage string)

StringVarF defines 2 string flags for specified name and shortName, default value, and usage string. The argument ptr points to a string variable in which to store the value of the flag.

Jump to

Keyboard shortcuts

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