summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorAlex Flint <[email protected]>2021-04-19 13:59:00 -0700
committerAlex Flint <[email protected]>2021-04-19 13:59:00 -0700
commit91214e01ea30c8615fde40cf08934d9fb9517376 (patch)
tree940b190d92444f2e1eac5659676ef5670607bec9 /README.md
parent0100c0a411486a0a26c0d7bb5504c5f371aaf6b0 (diff)
add an example of parsing into a map to the readme
Diffstat (limited to 'README.md')
-rw-r--r--README.md15
1 files changed, 15 insertions, 0 deletions
diff --git a/README.md b/README.md
index da69469..48fa2f0 100644
--- a/README.md
+++ b/README.md
@@ -191,6 +191,7 @@ var args struct {
Files []string `arg:"-f,separate"`
Databases []string `arg:"positional"`
}
+arg.MustParse(&args)
```
```shell
@@ -200,6 +201,20 @@ Files [file1 file2 file3]
Databases [db1 db2 db3]
```
+### Arguments with keys and values
+```go
+var args struct {
+ UserIDs map[string]int
+}
+arg.MustParse(&args)
+fmt.Println(args.UserIDs)
+```
+
+```shell
+./example --userids john=123 mary=456
+map[john:123 mary:456]
+```
+
### Custom validation
```go
var args struct {