diff --git a/crates/suiop-cli/src/cli/incidents/mod.rs b/crates/suiop-cli/src/cli/incidents/mod.rs index 9436c501e7737..dff7868b76ad5 100644 --- a/crates/suiop-cli/src/cli/incidents/mod.rs +++ b/crates/suiop-cli/src/cli/incidents/mod.rs @@ -30,6 +30,9 @@ pub enum IncidentsAction { /// the days to go back #[arg(short, long, default_value = "7")] days: usize, + /// limit to incidents with any priority set + #[arg(long, short = 'p', default_value = "false")] + with_priority: bool, }, /// generate Jira tasks for incident follow ups #[command(name = "generate follow up tasks", aliases=["g", "gen", "generate"])] @@ -42,9 +45,12 @@ pub enum IncidentsAction { pub async fn incidents_cmd(args: &IncidentsArgs) -> Result<()> { match &args.action { - IncidentsAction::GetRecentIncidents { long, limit, days } => { - print_recent_incidents(*long, *limit, *days).await? - } + IncidentsAction::GetRecentIncidents { + long, + limit, + days, + with_priority, + } => print_recent_incidents(*long, *limit, *days, *with_priority).await?, IncidentsAction::GenerateFollowUpTasks { input_filename } => { generate_follow_up_tasks(input_filename).await? } diff --git a/crates/suiop-cli/src/cli/incidents/pd.rs b/crates/suiop-cli/src/cli/incidents/pd.rs index 6369c9b942c2a..e588a9954400b 100644 --- a/crates/suiop-cli/src/cli/incidents/pd.rs +++ b/crates/suiop-cli/src/cli/incidents/pd.rs @@ -87,7 +87,12 @@ async fn fetch_incidents( Ok(all_incidents) } -pub async fn print_recent_incidents(long: bool, limit: usize, days: usize) -> Result<()> { +pub async fn print_recent_incidents( + long: bool, + limit: usize, + days: usize, + with_priority: bool, +) -> Result<()> { let current_time = Local::now(); let start_time = current_time - Duration::days(days as i64); let date_format_in = "%Y-%m-%dT%H:%M:%SZ"; @@ -151,6 +156,10 @@ pub async fn print_recent_incidents(long: bool, limit: usize, days: usize) -> Re Some("P4") => "P4".white(), _ => " ".white(), }; + if with_priority && priority == " ".white() { + // skip incidents without priority + continue; + } println!( "{}: ({}) {} {} ({})", incident["incident_number"]