Skip to content

Commit 052cb84

Browse files
authored
docs: encourage use of -- as default practice (#103)
1 parent 89d021b commit 052cb84

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

README.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,26 @@ pnpm add -g dotenv-cli
2020
## Usage
2121

2222
```bash
23-
$ dotenv <command with arguments>
23+
$ dotenv -- <command with arguments>
2424
```
2525

2626
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).
2727

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+
2834
### Custom .env files
2935
Another .env file could be specified using the -e flag:
3036
```bash
31-
$ dotenv -e .env2 <command with arguments>
37+
$ dotenv -e .env2 -- <command with arguments>
3238
```
3339

3440
Multiple .env files can be specified, and will be processed in order:
3541
```bash
36-
$ dotenv -e .env3 -e .env4 <command with arguments>
42+
$ dotenv -e .env3 -e .env4 -- <command with arguments>
3743
```
3844

3945
### Cascading env variables
@@ -48,12 +54,12 @@ dotenv -e ../.env -c
4854
### Setting variable from command line
4955
It is possible to set variable directly from command line using the -v flag:
5056
```bash
51-
$ dotenv -v VARIABLE=somevalue <command with arguments>
57+
$ dotenv -v VARIABLE=somevalue -- <command with arguments>
5258
```
5359

5460
Multiple variables can be specified:
5561
```bash
56-
$ dotenv -v VARIABLE1=somevalue1 -v VARIABLE2=somevalue2 <command with arguments>
62+
$ dotenv -v VARIABLE1=somevalue1 -v VARIABLE2=somevalue2 -- <command with arguments>
5763
```
5864

5965
Variables set up from command line have higher priority than from env files.

0 commit comments

Comments
 (0)