diff options
| author | Illia Volochii <[email protected]> | 2018-04-26 21:10:44 +0300 |
|---|---|---|
| committer | Illia Volochii <[email protected]> | 2018-04-26 21:10:44 +0300 |
| commit | 75bf1a1525e860418b617b6440255fddd2eed205 (patch) | |
| tree | 7d0e517277a2f398fecaa7dfb4ad874274277c8d /README.md | |
| parent | 074ee5f759999d103724b5594e33901adeb28e73 (diff) | |
Fix providing multiple values via environment variables
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -94,6 +94,22 @@ $ NUM_WORKERS=4 ./example Workers: 4 ``` +You should use a JSON array of strings (value will be converted if +necessary) in the case of multiple values: + +```go +var args struct { + Workers []int `arg:"env"` +} +arg.MustParse(&args) +fmt.Println("Workers:", args.Workers) +``` + +``` +$ WORKERS='["1", "99"]' ./example +Workers: [1 99] +``` + ### Usage strings ```go var args struct { |
