Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: added --quiet flag to silent local run #1723

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
3 changes: 3 additions & 0 deletions cargo-shuttle/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,9 @@ pub struct RunArgs {

#[command(flatten)]
pub secret_args: SecretsArgs,

#[arg(long)]
pub quiet: bool,
}

#[derive(Parser, Debug, Default)]
Expand Down
7 changes: 7 additions & 0 deletions cargo-shuttle/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1116,6 +1116,13 @@ impl Shuttle {
service: &BuiltService,
idx: u16,
) -> Result<Option<(Child, runtime::Client)>> {
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)
Expand Down
1 change: 1 addition & 0 deletions common-tests/src/cargo_shuttle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
};

Expand Down