Read log_level from env CARGO_BINSTALL_LOG_LEVEL if arg not present (#790)

* Enable feature "env" on dep clap in bin
* Read log_level from env `CARGO_BINSTALL_LOG_LEVEL` if arg not present

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
Jiahao XU 2023-02-11 14:59:38 +11:00 committed by GitHub
parent b408a1a9dd
commit e84228ba01
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View file

@ -24,7 +24,7 @@ pkg-fmt = "zip"
[dependencies]
binstalk = { path = "../binstalk", version = "0.8.0", default-features = false }
binstalk-manifests = { path = "../binstalk-manifests", version = "0.3.0" }
clap = { version = "4.1.4", features = ["derive"] }
clap = { version = "4.1.4", features = ["derive", "env"] }
crates_io_api = { version = "0.8.1", default-features = false }
dirs = "4.0.0"
fs-lock = { version = "0.1.0", path = "../fs-lock" }

View file

@ -226,7 +226,12 @@ pub struct Args {
///
/// Set to `off` to disable logging completely, this will also
/// disable output from `cargo-install`.
#[clap(help_heading = "Meta", long, value_name = "LEVEL")]
#[clap(
help_heading = "Meta",
long,
value_name = "LEVEL",
env = "CARGO_BINSTALL_LOG_LEVEL"
)]
pub log_level: Option<LevelFilter>,
/// Equivalent to setting `log_level` to `off`.