Skip to content

Commit

Permalink
Merge pull request #2256 from itowlson/distinctify-trigger-help-headings
Browse files Browse the repository at this point in the history
Include trigger type in trigger options help header
  • Loading branch information
itowlson authored Jan 29, 2024
2 parents e5921ae + 304ac22 commit 96498fe
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion crates/trigger/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub const SPIN_WORKING_DIR: &str = "SPIN_WORKING_DIR";
#[derive(Parser, Debug)]
#[clap(
usage = "spin [COMMAND] [OPTIONS]",
next_help_heading = "TRIGGER OPTIONS"
next_help_heading = help_heading::<Executor>()
)]
pub struct TriggerExecutorCommand<Executor: TriggerExecutor>
where
Expand Down Expand Up @@ -255,6 +255,12 @@ fn warn_if_wasm_build_slothful() -> sloth::SlothGuard {
sloth::warn_if_slothful(SLOTH_WARNING_DELAY_MILLIS, format!("{message}\n"))
}

fn help_heading<E: TriggerExecutor>() -> Option<&'static str> {
let heading = format!("{} TRIGGER OPTIONS", E::TRIGGER_TYPE.to_uppercase());
let as_str = Box::new(heading).leak();
Some(as_str)
}

pub mod help {
use super::*;

Expand Down

0 comments on commit 96498fe

Please # to comment.