adotenv-cli
Command-line tools for literal .env files, built on
adotenv.
cargo install adotenv-cli --locked
The binary is adotenv-cli.
adotenv-cli [--dialect portable|node|python|compose|docker] [--dialect=<value>] <command> [options]
get <file> <key>
check [--format human|json|github] [--json] [--source] [--recursive] [--exclude <path>] <path>...
fmt [--write|--check] [--sort] [--recursive] [--exclude <path>] <path>...
diff [--format human|matrix|json] [--json] [--mask] <baseline> <file>...
example <file>
load <directory> [mode]
set <file> <key> <value>
run <directory> [mode] -- <program> [args...]
run starts the program with the parent environment plus the loaded values. A
loaded value replaces a parent variable of the same name, and the parent
environment is not changed. On Windows it rejects keys that differ only by case
and values longer than 32,767 UTF-16 code units before starting the child.
Loaded files are trusted like code: a loaded PATH changes which program
runs.
get, load and diff print values by default, including JSON and matrix
output of diff; diff --mask replaces compared values with ***. fmt
without --write or --check prints whole documents, values included, and
check --source prints source lines. load prints Portable KEY=value lines
that parse back to the same values. example removes values but keeps comments
verbatim.
fmt --write and set leave a file untouched when the result would not change
it. Otherwise they replace the file through a private temporary file in the
same directory, keep its mode, owner and group where possible, and write through
symbolic links. On Unix the replace is an atomic rename. On Windows the fallback
backup swap is not crash-atomic.
Values stay literal. The CLI does not expand references or run command substitutions from files.
Exit codes are 0 for success, 1 for findings such as error diagnostics or
differences, and 2 for usage errors, read or write failures and input a
command cannot process. Warnings do not change the exit code. run exits with
the child's code. See the
command-line tool guide.
The crate has no dependencies outside the workspace and needs Rust 1.81 or later.