You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+11-5Lines changed: 11 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,20 +20,26 @@ pnpm add -g dotenv-cli
20
20
## Usage
21
21
22
22
```bash
23
-
$ dotenv <command with arguments>
23
+
$ dotenv -- <command with arguments>
24
24
```
25
25
26
26
This will load the variables from the .env file in the current working directory and then run the command (using the new set of environment variables).
27
27
28
+
Alternatively, if you do not need to pass arguments to the command, you can use the shorthand:
29
+
30
+
```bash
31
+
$ dotenv <command>
32
+
```
33
+
28
34
### Custom .env files
29
35
Another .env file could be specified using the -e flag:
30
36
```bash
31
-
$ dotenv -e .env2 <command with arguments>
37
+
$ dotenv -e .env2 -- <command with arguments>
32
38
```
33
39
34
40
Multiple .env files can be specified, and will be processed in order:
35
41
```bash
36
-
$ dotenv -e .env3 -e .env4 <command with arguments>
42
+
$ dotenv -e .env3 -e .env4 -- <command with arguments>
37
43
```
38
44
39
45
### Cascading env variables
@@ -48,12 +54,12 @@ dotenv -e ../.env -c
48
54
### Setting variable from command line
49
55
It is possible to set variable directly from command line using the -v flag:
50
56
```bash
51
-
$ dotenv -v VARIABLE=somevalue <command with arguments>
57
+
$ dotenv -v VARIABLE=somevalue -- <command with arguments>
52
58
```
53
59
54
60
Multiple variables can be specified:
55
61
```bash
56
-
$ dotenv -v VARIABLE1=somevalue1 -v VARIABLE2=somevalue2 <command with arguments>
62
+
$ dotenv -v VARIABLE1=somevalue1 -v VARIABLE2=somevalue2 -- <command with arguments>
57
63
```
58
64
59
65
Variables set up from command line have higher priority than from env files.
0 commit comments