From e6afe6040885d637e9715e996c9a2a3293039eeb Mon Sep 17 00:00:00 2001 From: Urgau Date: Sun, 29 Jun 2025 14:10:00 +0200 Subject: [PATCH] Also support `concern resolve` to resolve concerns --- parser/src/command.rs | 12 ++++++++++++ parser/src/command/concern.rs | 9 ++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/parser/src/command.rs b/parser/src/command.rs index fb3910b6e..27b8c0fa2 100644 --- a/parser/src/command.rs +++ b/parser/src/command.rs @@ -374,6 +374,18 @@ fn concern() { ); } +#[test] +fn concern_resolve() { + let input = "@bot concern resolve this is my concern"; + let mut input = Input::new(input, vec!["bot"]); + assert_eq!( + input.next(), + Some(Command::Concern(Ok(concern::ConcernCommand::Resolve { + title: "this is my concern".to_string() + }))) + ); +} + #[test] fn resolve() { let input = "@bot resolve this is my concern"; diff --git a/parser/src/command/concern.rs b/parser/src/command/concern.rs index 5c95a7454..c0922e93f 100644 --- a/parser/src/command/concern.rs +++ b/parser/src/command/concern.rs @@ -25,9 +25,16 @@ impl fmt::Display for ParseError { impl ConcernCommand { pub fn parse<'a>(input: &mut Tokenizer<'a>) -> Result, Error<'a>> { let mut toks = input.clone(); - if let Some(Token::Word(action @ ("concern" | "resolve"))) = toks.peek_token()? { + if let Some(Token::Word(mut action @ ("concern" | "resolve"))) = toks.peek_token()? { toks.next_token()?; + if action == "concern" { + if let Some(Token::Word(sub_action @ "resolve")) = toks.peek_token()? { + toks.next_token()?; + action = sub_action; + } + } + let title = toks.take_line()?.trim().to_string(); if title.is_empty() {