-
Notifications
You must be signed in to change notification settings - Fork 0
Usage
Navigate to a project that contains one or many .env
files, then type:
nvi <flag> <arg>
All flags below are optional with the exception that at least one of these flags must be defined:
- config flag
- print flag
- an api flag
- system commands
Only long form (--
) flags are supported.
flag | flag description |
---|---|
—-api |
Specifies whether or not to retrieve ENVs from the remote API. (ex: —-api) |
--config |
Specifies which environment config to load from the .nvi file. (ex: --config dev)‡ |
--debug |
Specifies whether or not to log debug details. (ex: --debug) |
--directory |
Specifies which directory the .env files are located within. (ex: --directory path/to/envs) |
--environment |
Specifies which environment config to use within a remote project. (ex: --environment dev)‡‡ |
--files |
Specifies which .env files to parse separated by a space. (ex: --files test.env test2.env) |
--project |
Specifies which remote project to select from the nvi API. (ex: --project my_project)‡‡ |
--print |
Specifies whether or not to print ENVs to standard out. (ex: --print) |
--required |
Specifies which ENV keys are required separated by a space. (ex: --required KEY1 KEY2) |
--save |
Specifies whether or not to save remote ENVs to disk with the selected environment name. (ex: --save)‡‡ |
--help |
Displays this help information. |
--version |
Displays binary information. |
-- |
Specifies which system command to run in a child process with parsed ENVs. (ex: -- cargo run)‡‡‡ |
‡ When a "--config" flag is present, then all the other flags are ignored as they should be defined within a configuration file.
‡‡ When retrieving and saving remote ENVs from the nvi API, the "api" flag must be defined while the "project" and "environment" flags are optional (this will prompt for available selections).
‡‡‡ The "--" (execute) flag needs be the last defined flag. It will also override the "print" flag and any flags after it will be consumed as part of the system command.
Instead of manually typing out flags and arguments in the CLI, you can place them in a .nvi
configuration file.
The configuration file is a TOML-like formatted file that contains...
- An
[environment]
name that defines the following optional properties:-
api: boolean (default:
false
) -
debug: boolean (default:
false
) -
directory: string (default:
""
) -
environment: string (default:
""
) -
execute: string (default:
""
) -
files: string[] (default
[".env"]
) -
print: boolean (default:
false
) -
project: string (default:
""
) -
required: string[] (default
[]
) -
save: boolean (default
false
)
-
api: boolean (default:
The following represents an example .nvi
configuration:
[dev]
debug = true
directory = "path/to/custom/dir"
files = [ ".env", "base.env", "reference.env" ]
execute = "bin test"
required = [ "TEST1", "TEST2", "TEST3" ]
[staging]
files = [ ".env" ]
required = [ "TEST1" ]
[remote_dev]
api = true
debug = true
environment = "development"
execute = "bin dev"
project = "my_project"
required = [ "TEST1", "TEST2", "TEST3" ]
save = true
To target a configuration within the .nvi config file, simply use the --config
flag followed by the config name:
nvi --config staging
Please read this for config file specs.