 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
- Constants
- Variables
- type Argument
- type ArgumentType
- type Error
- type ErrorType
- type HelpText
- type OptMap
- type Option
- type OptionValue
- func (ov OptionValue) Bool() (value bool, found bool, err error)
- func (ov OptionValue) Definition() Option
- func (ov OptionValue) Float() (value float64, found bool, err error)
- func (ov OptionValue) Found() bool
- func (ov OptionValue) Int() (value int, found bool, err error)
- func (ov OptionValue) String() (value string, found bool, err error)
- func (ov OptionValue) Uint() (value uint, found bool, err error)
 
Constants ¶
      View Source
      
  const ( Invalid = reflect.Invalid Bool = reflect.Bool Int = reflect.Int Uint = reflect.Uint Float = reflect.Float64 String = reflect.String )
Types of Command options
      View Source
      
  const ( EncShort = "enc" EncLong = "encoding" RecShort = "r" RecLong = "recursive" ChanOpt = "stream-channels" TimeoutOpt = "timeout" )
Flag names
Variables ¶
      View Source
      
  var OptionEncodingType = StringOption(EncLong, EncShort, "The encoding type the output should be encoded with (json, xml, or text)")
    options that are used by this package
      View Source
      
  
    var OptionRecursivePath = BoolOption(RecLong, RecShort, "Add directory paths recursively").Default(false)
    
      View Source
      
  
    var OptionStreamChannels = BoolOption(ChanOpt, "Stream channel output")
    
      View Source
      
  
var OptionTimeout = StringOption(TimeoutOpt, "set a global timeout on the command")
    Functions ¶
This section is empty.
Types ¶
type Argument ¶
type Argument struct {
	Name          string
	Type          ArgumentType
	Required      bool // error if no value is specified
	Variadic      bool // unlimited values can be specfied
	SupportsStdin bool // can accept stdin as a value
	Recursive     bool // supports recursive file adding (with '-r' flag)
	Description   string
}
    func (Argument) EnableRecursive ¶
func (Argument) EnableStdin ¶
type HelpText ¶
type HelpText struct {
	// required
	Tagline               string            // used in <cmd usage>
	ShortDescription      string            // used in DESCRIPTION
	SynopsisOptionsValues map[string]string // mappings for synopsis generator
	// optional - whole section overrides
	Usage           string // overrides USAGE section
	LongDescription string // overrides DESCRIPTION section
	Options         string // overrides OPTIONS section
	Arguments       string // overrides ARGUMENTS section
	Subcommands     string // overrides SUBCOMMANDS section
	Synopsis        string // overrides SYNOPSIS field
}
    HelpText is a set of strings used to generate command help text. The help text follows formats similar to man pages, but not exactly the same.
type Option ¶
type Option interface {
	Names() []string            // a list of unique names matched with user-provided flags
	Type() reflect.Kind         // value must be this type
	Description() string        // a short string that describes this option
	Default(interface{}) Option // sets the default value of the option
	DefaultVal() interface{}
}
    Option is used to specify a field that will be provided by a consumer
func BoolOption ¶
func FloatOption ¶
func StringOption ¶
func UintOption ¶
type OptionValue ¶
func (OptionValue) Bool ¶
func (ov OptionValue) Bool() (value bool, found bool, err error)
value accessor methods, gets the value as a certain type
func (OptionValue) Definition ¶
func (ov OptionValue) Definition() Option
Definition returns the option definition for the provided value
func (OptionValue) Found ¶
func (ov OptionValue) Found() bool
Found returns true if the option value was provided by the user (not a default value)
 Click to show internal directories. 
   Click to hide internal directories.