From 419976d275dd8f2b24eabec69fb5d86624dd05ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christina=20S=C3=B8rensen?= Date: Thu, 12 Sep 2024 11:21:10 +0200 Subject: [PATCH] feat(args): add `-L/--print-build-logs` flag, to feel more like nix3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Christina Sørensen --- crates/nix-weather/src/cli.rs | 5 +++++ crates/nix-weather/src/main.rs | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/crates/nix-weather/src/cli.rs b/crates/nix-weather/src/cli.rs index 79105b6..9f35095 100644 --- a/crates/nix-weather/src/cli.rs +++ b/crates/nix-weather/src/cli.rs @@ -31,4 +31,9 @@ pub fn build_cli() -> Command { .required(false), ) .arg(arg!(-v --verbose ... "Verbosity level.")) + .arg( + arg!(printBuildLogs: -L "Verbosity level.") + .long("print-build-logs") + .conflicts_with("verbose"), + ) } diff --git a/crates/nix-weather/src/main.rs b/crates/nix-weather/src/main.rs index b9cee3e..d69c3b1 100644 --- a/crates/nix-weather/src/main.rs +++ b/crates/nix-weather/src/main.rs @@ -37,6 +37,8 @@ async fn main() -> io::Result<()> { // message informing them. let mut very_bose = false; + // The Normal verbose flag, allowing multiple levels. Conflicts with + // printBuildLogs. match matches .get_one::("verbose") .expect("Counts aren't defaulted") @@ -52,6 +54,11 @@ async fn main() -> io::Result<()> { } } + // The -L flag, to give a more nix3 feel + if matches.get_flag("printBuildLogs") { + env::set_var("RUST_LOG", "trace") + } + if matches.get_flag("timestamp") { pretty_env_logger::formatted_timed_builder() .parse_env("RUST_LOG")