@@ -521,7 +521,7 @@ fn parser_priority(command: &CommandPart<'_>, parts: &[CommandPart<'_>]) -> Pars
521521 Ok ( p) => p,
522522 Err ( e) => return Some ( Err ( e) ) ,
523523 } ;
524- let note = join_parts ( parts) ;
524+ let note = parse_note ( parts) ;
525525 Some ( Ok ( BorsCommand :: SetPriority { priority, note } ) )
526526}
527527
@@ -550,7 +550,7 @@ fn parser_rollup(command: &CommandPart<'_>, parts: &[CommandPart<'_>]) -> ParseR
550550 Ok ( r) => r,
551551 Err ( e) => return Some ( Err ( e) ) ,
552552 } ;
553- let note = join_parts ( parts) ;
553+ let note = parse_note ( parts) ;
554554 Some ( Ok ( BorsCommand :: SetRollupMode { rollup_mode, note } ) )
555555}
556556
@@ -594,6 +594,13 @@ fn parser_tree_ops(command: &CommandPart<'_>, parts: &[CommandPart<'_>]) -> Pars
594594 }
595595}
596596
597+ fn parse_note ( parts : & [ CommandPart < ' _ > ] ) -> Option < String > {
598+ match parts {
599+ & [ CommandPart :: KeyValue { key : "note" , value } ] => Some ( value. to_string ( ) ) ,
600+ parts => join_parts ( parts) ,
601+ }
602+ }
603+
597604/// Join all the command parts into a single string.
598605/// If there are no other parts, returns `None`.
599606fn join_parts ( parts : & [ CommandPart < ' _ > ] ) -> Option < String > {
@@ -1012,6 +1019,23 @@ mod tests {
10121019 ) ;
10131020 }
10141021
1022+ #[ test]
1023+ fn parse_priority_explicit_note ( ) {
1024+ let cmds = parse_commands ( "@bors p=1 note=a" ) ;
1025+ insta:: assert_debug_snapshot!( cmds, @r#"
1026+ [
1027+ Ok(
1028+ SetPriority {
1029+ priority: 1,
1030+ note: Some(
1031+ "a",
1032+ ),
1033+ },
1034+ ),
1035+ ]
1036+ "# ) ;
1037+ }
1038+
10151039 #[ test]
10161040 fn parse_priority_unknown_arg ( ) {
10171041 let cmds = parse_commands ( "@bors p=1 a" ) ;
@@ -1244,6 +1268,23 @@ mod tests {
12441268 "# ) ;
12451269 }
12461270
1271+ #[ test]
1272+ fn parse_rollup_explicit_note ( ) {
1273+ let cmds = parse_commands ( "@bors rollup note=a" ) ;
1274+ insta:: assert_debug_snapshot!( cmds, @r#"
1275+ [
1276+ Ok(
1277+ SetRollupMode {
1278+ rollup_mode: Always,
1279+ note: Some(
1280+ "a",
1281+ ),
1282+ },
1283+ ),
1284+ ]
1285+ "# ) ;
1286+ }
1287+
12471288 #[ test]
12481289 fn parse_rollup_unknown_arg ( ) {
12491290 let cmds = parse_commands ( "@bors rollup a" ) ;
0 commit comments