summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorevgenv123 <[email protected]>2021-09-18 22:23:26 +0700
committerGitHub <[email protected]>2021-09-18 22:23:26 +0700
commitb157e8d10a29fcea34b33988776848a322ef69dc (patch)
tree131cf35b46afafd5f3a9208f58618434cfd59a19 /README.md
parentff38a63b36f6b4e60c34ffd0dbf6529d73fa5950 (diff)
Update README.md
Hi! As a first-time user of your great package I got a little bit confused on using command line args and env vars together, so it took me some time to make testing and I propose to save this time for other people by adding relevant edits to README.md
Diffstat (limited to 'README.md')
-rw-r--r--README.md13
1 files changed, 13 insertions, 0 deletions
diff --git a/README.md b/README.md
index 229a9df..855c02e 100644
--- a/README.md
+++ b/README.md
@@ -158,6 +158,19 @@ var args struct {
arg.MustParse(&args)
```
+### Priority
+
+You can use both command line arguments and environmental variables at the same time.
+The priority is as follows: <b>command line arguments</b> -> if empty we check <b>environmental variables</b> -> and then we use <b>default values</b>
+
+```go
+var args struct {
+ Command string `arg:"-c,env:COMMAND" help:"Command to execute" default:"remove"`
+ File string `arg:"-f,env:FILE_NAME"`
+}
+arg.MustParse(&args)
+```
+
### Default values (before v1.2)
```go