Skip to content

Commit

Permalink
feat: add silent flag to shell (#437)
Browse files Browse the repository at this point in the history
* feat: add silent flag

* Update shell.rs

* fix: lint
  • Loading branch information
alexng353 authored Sep 26, 2023
1 parent 00c9474 commit 22c69bd
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/commands/shell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ pub struct Args {
/// Service to pull variables from (defaults to linked service)
#[clap(short, long)]
service: Option<String>,

/// Open shell without banner
#[clap(long)]
silent: bool,
}

pub async fn command(args: Args, _json: bool) -> Result<()> {
Expand Down Expand Up @@ -103,7 +107,9 @@ pub async fn command(args: Args, _json: bool) -> Result<()> {
_ => vec![],
};

println!("Entering subshell with Railway variables available. Type 'exit' to exit.\n");
if !args.silent {
println!("Entering subshell with Railway variables available. Type 'exit' to exit.\n");
}

// a bit janky :/
ctrlc::set_handler(move || {
Expand All @@ -120,7 +126,9 @@ pub async fn command(args: Args, _json: bool) -> Result<()> {
.await
.context("Failed to wait for command")?;

println!("Exited subshell, Railway variables no longer available.");
if !args.silent {
println!("Exited subshell, Railway variables no longer available.");
}
Ok(())
}

Expand Down

0 comments on commit 22c69bd

Please sign in to comment.