From b157e8d10a29fcea34b33988776848a322ef69dc Mon Sep 17 00:00:00 2001
From: evgenv123 <83824538+evgenv123@users.noreply.github.com>
Date: Sat, 18 Sep 2021 22:23:26 +0700
Subject: [PATCH] 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
---
README.md | 13 +++++++++++++
1 file changed, 13 insertions(+)
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: command line arguments -> if empty we check environmental variables -> and then we use default values
+
+```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