summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorEmmanouil "Manolis" Maragkakis <[email protected]>2017-01-23 20:41:12 -0500
committerEmmanouil "Manolis" Maragkakis <[email protected]>2017-01-23 20:41:12 -0500
commitdb274311536204025bd248faaa74347707be9d76 (patch)
tree9fb9264188c1c93a7340885797956e86dad97075 /README.md
parent7c77c70f8528a7b3310820aeec46d56a5be1ba70 (diff)
add support for description string
Diffstat (limited to 'README.md')
-rw-r--r--README.md27
1 files changed, 27 insertions, 0 deletions
diff --git a/README.md b/README.md
index bc761de..8b6f3d8 100644
--- a/README.md
+++ b/README.md
@@ -263,6 +263,33 @@ usage: example [--name NAME]
error: error processing --name: missing period in "oops"
```
+### Description strings
+
+```go
+type args struct {
+ Foo string
+}
+
+func (args) Description() string {
+ return "this program does this and that"
+}
+
+func main() {
+ var args args
+ arg.MustParse(&args)
+}
+```
+
+```shell
+$ ./example -h
+this program does this and that
+usage: example [--foo FOO]
+
+options:
+ --foo FOO
+ --help, -h display this help and exit
+```
+
### Documentation
https://godoc.org/github.com/alexflint/go-arg