From 519fa7ea58020583e2fa63317a0a76dc458d47d3 Mon Sep 17 00:00:00 2001 From: sourabpramanik Date: Thu, 4 Apr 2024 21:54:36 +0530 Subject: [PATCH 1/2] feat: add --quiet flag to silent all the non error prints and runtime prints --- cargo-shuttle/src/args.rs | 3 +++ cargo-shuttle/src/lib.rs | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/cargo-shuttle/src/args.rs b/cargo-shuttle/src/args.rs index 264436c56..257612d4d 100644 --- a/cargo-shuttle/src/args.rs +++ b/cargo-shuttle/src/args.rs @@ -287,6 +287,9 @@ pub struct RunArgs { #[command(flatten)] pub secret_args: SecretsArgs, + + #[arg(long)] + pub quiet: bool, } #[derive(Parser, Debug, Default)] diff --git a/cargo-shuttle/src/lib.rs b/cargo-shuttle/src/lib.rs index 23b2dbb08..a98750488 100644 --- a/cargo-shuttle/src/lib.rs +++ b/cargo-shuttle/src/lib.rs @@ -1034,6 +1034,13 @@ impl Shuttle { service: &BuiltService, idx: u16, ) -> Result> { + macro_rules! println { + ($($rest:tt)*) => { + if !std::env::args().any(|arg| arg == "--quiet") { + std::println!($($rest)*); + } + } + } let secrets_file = run_args.secret_args.secrets.clone().or_else(|| { let crate_dir = service.crate_directory(); // Prioritise crate-local prod secrets over workspace dev secrets (in the rare case that both exist) From d830220e616ef748a464f2f010aaf96e8f851ca9 Mon Sep 17 00:00:00 2001 From: sourabpramanik Date: Fri, 5 Apr 2024 08:10:45 +0530 Subject: [PATCH 2/2] feat: add --quiet flag --- common-tests/src/cargo_shuttle.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/common-tests/src/cargo_shuttle.rs b/common-tests/src/cargo_shuttle.rs index 1cfe17d22..5fdfe0024 100644 --- a/common-tests/src/cargo_shuttle.rs +++ b/common-tests/src/cargo_shuttle.rs @@ -31,6 +31,7 @@ pub async fn cargo_shuttle_run(working_directory: &str, external: bool) -> Strin external, release: false, raw: false, + quiet: false, secret_args: Default::default(), };