command
Version:
v0.0.0-...-bc19bdb
Opens a new window with list of versions in this module.
Published: Mar 7, 2016
License: MIT, MIT
Opens a new window with license information.
Imports: 2
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
subcmds example
<tmpl,code=go:cat subcmds.go>
package main
import (
"fmt"
"github.com/jpillora/opts"
)
type FooConfig struct {
Ping string
Pong string
}
//config
type Config struct {
Cmd string `type:"cmdname"`
//subcommand (external struct)
Foo FooConfig
//subcommand (inline struct)
Bar struct {
Zip string
Zap string
}
}
func main() {
c := Config{}
opts.Parse(&c)
fmt.Println(c.Cmd)
fmt.Println(c.Bar.Zip)
fmt.Println(c.Bar.Zap)
}
```
$ subcmds bar --zip hello --zap world
```
``` plain
bar
hello
world
```
```
$ subcmds --help
```
``` plain
Usage: subcmds [options]
Options:
--help, -h
Subcommands:
</tmpl>
Documentation
¶
There is no documentation for this package.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.