From 75bf1a1525e860418b617b6440255fddd2eed205 Mon Sep 17 00:00:00 2001 From: Illia Volochii Date: Thu, 26 Apr 2018 21:10:44 +0300 Subject: Fix providing multiple values via environment variables --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'README.md') diff --git a/README.md b/README.md index e8b62a4..362f455 100644 --- a/README.md +++ b/README.md @@ -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 { -- cgit v1.2.3