Skip to content

Commit 5595695

Browse files
authored
Merge pull request #1997 from Urgau/relabel_with_space
Handle quoted labels in relabel commands
2 parents d2f19cf + 7e56160 commit 5595695

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

parser/src/command/relabel.rs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424
//! is with the previous two variants of this (i.e., ++label and -+label).
2525
//! - <label>
2626
//!
27-
//! <label>: \S+
27+
//! <label>:
28+
//! - \S+
29+
//! - ".+"
2830
//! ```
2931
3032
use crate::error::Error;
@@ -84,7 +86,7 @@ impl std::ops::Deref for Label {
8486
impl LabelDelta {
8587
fn parse<'a>(input: &mut Tokenizer<'a>) -> Result<LabelDelta, Error<'a>> {
8688
let delta = match input.peek_token()? {
87-
Some(Token::Word(delta)) => {
89+
Some(Token::Word(delta) | Token::Quote(delta)) => {
8890
input.next_token()?;
8991
delta
9092
}
@@ -273,3 +275,15 @@ fn parse_shorter_command_with_to_colon() {
273275
]))
274276
);
275277
}
278+
279+
#[test]
280+
fn parse_quote() {
281+
assert_eq!(
282+
parse("labels +T-compiler \"-good first issue\" \"good first issue\""),
283+
Ok(Some(vec![
284+
LabelDelta::Add(Label("T-compiler".into())),
285+
LabelDelta::Remove(Label("good first issue".into())),
286+
LabelDelta::Add(Label("good first issue".into())),
287+
]))
288+
);
289+
}

0 commit comments

Comments
 (0)