Documentation ¶
Index ¶
- Variables
- func ExampleRun(r *Root, c *Sub)
- func GenManPagesRun(r *Root, c *Sub)
- func GenSingleLinksRun(r *Root, c *Sub)
- func GenerateRootPage(r *Root) error
- func GenerateSubPage(r *Root, name string) error
- func GenerateSubPages(r *Root) error
- func HelpRun(r *Root, c *Sub)
- func HiddenRun(r *Root, c *Sub)
- func PrintFlags(flags interface{})
- func Register(c *Sub)
- func VersionRun(r *Root, c *Sub)
- type ExampleArgs
- type ExampleFlags
- type GenSingleLinksArgs
- type HelpArgs
- type Root
- type Sub
Constants ¶
This section is empty.
Variables ¶
var Example = Sub{ Name: "example", Alias: "ex", Short: "Example command for testing", Flags: &ExampleFlags{}, Args: &ExampleArgs{}, Run: ExampleRun, }
Example fulfills the "example" subcommand
var GenManPages = Sub{ Name: "gen-man-pages", Alias: "gmp", Short: "Generate man-pages for the root command and each sub-command", Run: GenManPagesRun, Hidden: true, }
GenManPages fulfills the "gen-man-pages" subcommand
var GenSingleLinks = Sub{ Name: "gen-single-links", Short: "GenSingleLinks creates symlinks for a Single binary", Hidden: true, SkipMan: true, Args: &GenSingleLinksArgs{}, Run: GenSingleLinksRun, }
GenSingleLinks fulfills the "gen-single-links" subcommand
var Help = Sub{ Name: "help", Alias: "?", Short: "Get help with a specific subcommand", SkipMan: true, Args: &HelpArgs{}, Run: HelpRun, }
Help fulfills the "help" subcommand
var Hidden = Sub{ Name: "hidden", Alias: "hi", Short: "Hidden command for testing", Hidden: true, Run: HiddenRun, }
Hidden fulfills the "hidden" subcommand
var Version = Sub{ Name: "version", Short: "Print the version of this command", SkipMan: true, Run: VersionRun, }
Version fulfills the "hidden" subcommand
Functions ¶
func ExampleRun ¶
ExampleRun prints the usage for the requested command
func GenManPagesRun ¶
GenManPagesRun prints the usage for the requested command
func GenSingleLinksRun ¶
GenSingleLinksRun prints the usage for the requested command
func GenerateRootPage ¶
GenerateRootPage generates a man-page for the root command
func GenerateSubPage ¶
GenerateSubPage generates a man-page for a single subcommand
func GenerateSubPages ¶
GenerateSubPages generates a man-page for every subcommand
func VersionRun ¶
VersionRun prints the version and optional copyright for a command
Types ¶
type ExampleArgs ¶
type ExampleArgs struct {
Args []uint8 `zero:"yes" desc:"Slice o' Args"`
}
ExampleArgs contains the arguments for the "example" subcommand
type ExampleFlags ¶
type ExampleFlags struct { Boop bool `short:"b" long:"boop" desc:"You saw nothing"` Bop bool `long:"bop" desc:"Ouch!"` }
ExampleFlags contains the additional flags for the "example" subcommand
type GenSingleLinksArgs ¶
type GenSingleLinksArgs struct {
Path string `desc:"output dir for symlinks"`
}
GenSingleLinksArgs specifies the output path for the links
type HelpArgs ¶
type HelpArgs struct {
Subcommand string `desc:"Command to get help for"`
}
HelpArgs contains the arguments for the "help" subcommand
type Root ¶
type Root struct { Name string Short string Flags interface{} Single bool Version string Copyright string License string }
Root is the main command that supports multiple Sub commands
func (*Root) Run ¶
func (r *Root) Run()
Run finds the appropriate CMD and executes it, or prints the global Usage