diff options
Diffstat (limited to 'example_test.go')
| -rw-r--r-- | example_test.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/example_test.go b/example_test.go index 5272393..acfacad 100644 --- a/example_test.go +++ b/example_test.go @@ -496,3 +496,19 @@ func Example_allSupportedTypes() { // output: } + +func Example_envVarOnly() { + os.Args = split("./example") + _ = os.Setenv("NUM_WORKERS", "my_key") + + defer os.Unsetenv("NUM_WORKERS") + + var args struct { + AuthKey string `arg:"-,--,env:NUM_WORKERS"` + } + + MustParse(&args) + + fmt.Println(args.AuthKey) + // output: my_key +} |
