flags

package
v2.12.0+incompatible Latest Latest
Warning

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

Go to latest
Published: May 13, 2020 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BadParameter

type BadParameter struct {
	Message string
}

BadParameter error

func (BadParameter) Error

func (e BadParameter) Error() string

type CmdInfo

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

CmdInfo contains info about single command with arguments

func NewFlagSetEx

func NewFlagSetEx(name, description string) *CmdInfo

NewFlagSetEx - create new command object

func (*CmdInfo) BoolVar

func (c *CmdInfo) BoolVar(p *bool, name string, defValue bool, usage string)

BoolVar defines a bool flag with specified name, default value, and usage string. The argument p points to a bool variable in which to store the value of the flag.

func (*CmdInfo) DefaultStringVar

func (c *CmdInfo) DefaultStringVar(p *string, usage string)

DefaultStringVar defines default string argument

func (*CmdInfo) Description

func (c *CmdInfo) Description() string

Description - command name

func (*CmdInfo) Initialize

func (c *CmdInfo) Initialize(name, description string)

Initialize initialises object

func (*CmdInfo) IntVar

func (c *CmdInfo) IntVar(p *int, name string, defValue int, argNAme string, usage string)

IntVar defines an int flag with specified name, default value, and usage string. The argument p points to an int variable in which to store the value of the flag.

func (*CmdInfo) NFlag

func (c *CmdInfo) NFlag() int

NFlag returns the number of flags that have been set.

func (*CmdInfo) Name

func (c *CmdInfo) Name() string

Name - command name

func (*CmdInfo) Parse

func (c *CmdInfo) Parse(arguments []string) error

Parse parses flag definitions from the argument list see description of Flagset.Parse()

func (*CmdInfo) StringVar

func (c *CmdInfo) StringVar(p *string, name string, defValue string, argNAme string, usage string)

StringVar defines a string flag with specified name, default value, and usage string. The argument p points to a string variable in which to store the value of the flag.

func (*CmdInfo) Usage

func (c *CmdInfo) Usage(short bool)

Usage - prints command usage

func (*CmdInfo) UsageFormetted

func (c *CmdInfo) UsageFormetted(w *tabwriter.Writer, short bool)

UsageFormetted - prints command usage into tabwriter

Jump to

Keyboard shortcuts

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