|
|
|
@ -43,6 +43,28 @@ func main() {
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Aliases
|
|
|
|
|
|
|
|
|
|
While the stdlib doesn't directly support flag aliases, this library allows for neater generation using a special syntax.
|
|
|
|
|
|
|
|
|
|
```go
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
|
|
import "flag"
|
|
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
|
fs := flag.NewFlagSet("myapp", flag.ExitOnError)
|
|
|
|
|
stringFlag := fs.String("string", "", "String flag")
|
|
|
|
|
fs.StringVar(stringFlag, "s", *stringFlag, "--string")
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
In the above code, a second flag was registered with the special `Usage` that simply declared what the long-form flag name was.
|
|
|
|
|
In this scenario, `ffmd` will generate docs similar to
|
|
|
|
|
```text
|
|
|
|
|
--string,-s
|
|
|
|
|
```
|
|
|
|
|
See the [example](examples/alias).
|
|
|
|
|
|
|
|
|
|
## License
|
|
|
|
|
|
|
|
|
|
[MIT](LICENSE)
|