mirror of
https://github.com/toddbluhm/env-cmd.git
synced 2025-12-08 18:23:33 +00:00
docs(readme): update variable expansion docs
This commit is contained in:
parent
065b110048
commit
361f731f88
16
README.md
16
README.md
@ -146,13 +146,25 @@ commands together that share the same environment variables.
|
|||||||
EnvCmd supports expanding `$var` values passed in as arguments to the command. The allows a user
|
EnvCmd supports expanding `$var` values passed in as arguments to the command. The allows a user
|
||||||
to provide arguments to a command that are based on environment variable values at runtime.
|
to provide arguments to a command that are based on environment variable values at runtime.
|
||||||
|
|
||||||
|
**NOTE:** You must escape the `$` character with `\` or your terminal might try to auto expand it before passing it to `env-cmd`.
|
||||||
|
|
||||||
**Terminal**
|
**Terminal**
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
# $USER will be expanded into the env value it contains at runtime
|
# $VAR will be expanded into the env value it contains at runtime
|
||||||
./node_modules/.bin/env-cmd -x node index.js --user=$USER
|
./node_modules/.bin/env-cmd -x node index.js --arg=\$VAR
|
||||||
```
|
```
|
||||||
|
|
||||||
|
or in `package.json` (use `\\` to insert a literal backslash)
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"script": {
|
||||||
|
"start": "env-cmd -x node index.js --arg=\\$VAR"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
### `--silent` suppresses env-cmd errors
|
### `--silent` suppresses env-cmd errors
|
||||||
|
|
||||||
EnvCmd supports the `--silent` flag the suppresses all errors generated by `env-cmd`
|
EnvCmd supports the `--silent` flag the suppresses all errors generated by `env-cmd`
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user