diff --git a/crates/taplo-cli/Cargo.toml b/crates/taplo-cli/Cargo.toml index 93c202ab5..149c7ebaf 100644 --- a/crates/taplo-cli/Cargo.toml +++ b/crates/taplo-cli/Cargo.toml @@ -20,7 +20,7 @@ toml-test = [] [dependencies] anyhow = { version = "1", features = ["backtrace"] } async-ctrlc = { version = "1.2.0", features = ["stream"], optional = true } -clap = { version = "3.0.0", features = ["derive", "cargo"] } +clap = { version = "3.0.0", features = ["derive", "cargo", "env"] } codespan-reporting = "0.11.1" futures = "0.3" glob = "0.3" diff --git a/crates/taplo-cli/src/args.rs b/crates/taplo-cli/src/args.rs index b2d9c8e8d..d13bb171f 100644 --- a/crates/taplo-cli/src/args.rs +++ b/crates/taplo-cli/src/args.rs @@ -22,7 +22,7 @@ pub struct TaploArgs { #[derive(Clone, Args)] pub struct GeneralArgs { /// Path to the Taplo configuration file. - #[clap(long, short)] + #[clap(long, short, env = "TAPLO_CONFIG")] pub config: Option, /// Set a cache path. diff --git a/site/site/cli/usage/configuration.md b/site/site/cli/usage/configuration.md index dc3d52c4c..02e5b51d4 100644 --- a/site/site/cli/usage/configuration.md +++ b/site/site/cli/usage/configuration.md @@ -23,4 +23,4 @@ The available log levels: -Taplo CLI by default searches for a Taplo config file in the current working directory, this behaviour can be disabled by either supplying `--no-auto-config` or `--config ` flags. +Taplo CLI, by default, searches the current working directory for a Taplo configuration file. This behaviour can be disabled by either supplying `--no-auto-config` or `--config ` flags. The `TAPLO_CONFIG` environmental variable can also be used to set the configuration, but the `--config` flag will take precedence.