command
Version:
v0.0.0-...-56cfde8
Opens a new window with list of versions in this module.
Published: Mar 3, 2023
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
¶
cmds example
<tmpl,code=go:cat cmds.go>
package main
import (
"fmt"
"github.com/jpillora/opts"
)
type FooConfig struct {
Ping string
Pong string
}
//config
type Config struct {
Cmd string `type:"cmdname"`
//command (external struct)
Foo FooConfig
//command (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)
}
```
$ cmds bar --zip hello --zap world
```
``` plain
bar
hello
world
```
```
$ cmds --help
```
``` plain
Usage: cmds [options]
Options:
--help, -h
Commands:
• foo
• bar
</tmpl>
Documentation
¶
There is no documentation for this package.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.