@@ -148,6 +148,10 @@ async fn process_zulip_request(ctx: &Context, req: Request) -> anyhow::Result<Op
148
148
handle_command ( ctx, gh_id, & req. data , & req. message ) . await
149
149
}
150
150
151
+ const WORKQUEUE_HELP : & str = r#"`work show`: show your assigned PRs
152
+ `work set-pr-limit <number>|unlimited`: set the maximum number of PRs you can be assigned to
153
+ `work set-rotation-mode <off|on>`: configure if you are *on* rotation or *off* rotation (e.g. when you are on a vacation)"# ;
154
+
151
155
fn handle_command < ' a > (
152
156
ctx : & ' a Context ,
153
157
gh_id : anyhow:: Result < u64 > ,
@@ -179,7 +183,7 @@ fn handle_command<'a>(
179
183
Some ( "meta" ) => add_meta_notification ( & ctx, gh_id, words) . await
180
184
. map_err ( |e| format_err ! ( "Failed to parse `meta` command. Synopsis: meta <num> <text>: Add <text> to your notification identified by <num> (>0)\n \n Error: {e:?}" ) ) ,
181
185
Some ( "work" ) => workqueue_commands ( ctx, gh_id, words) . await
182
- . map_err ( |e| format_err ! ( "Failed to parse `work` command. Synopsis: work <show>: shows your current PRs assignment \n \n Error: {e:?}" ) ) ,
186
+ . map_err ( |e| format_err ! ( "Failed to parse `work` command. Help: {WORKQUEUE_HELP} \n \n Error: {e:?}" ) ) ,
183
187
_ => {
184
188
while let Some ( word) = next {
185
189
if word == "@**triagebot**" {
@@ -333,7 +337,7 @@ async fn workqueue_commands(
333
337
) ?)
334
338
}
335
339
}
336
- None => anyhow:: bail!( "Missing parameter. See `work help` for more information. " ) ,
340
+ None => anyhow:: bail!( "Missing parameter." ) ,
337
341
} ;
338
342
upsert_review_prefs (
339
343
& db_client,
@@ -361,29 +365,29 @@ async fn workqueue_commands(
361
365
match value {
362
366
"on" => RotationMode :: OnRotation ,
363
367
"off" => RotationMode :: OffRotation ,
364
- _ => anyhow:: bail!( "Unknown rotation mode {value}. Use `on` or `off`." )
368
+ _ => anyhow:: bail!( "Unknown rotation mode {value}. Use `on` or `off`." ) ,
365
369
}
366
370
}
367
- None => anyhow:: bail!( "Missing parameter. See `work help` for more information. " ) ,
371
+ None => anyhow:: bail!( "Missing parameter." ) ,
368
372
} ;
369
373
upsert_review_prefs (
370
374
& db_client,
371
375
user,
372
376
review_prefs. and_then ( |p| p. max_assigned_prs . map ( |v| v as u32 ) ) ,
373
377
rotation_mode,
374
378
)
375
- . await
376
- . context ( "Error occurred while setting review preferences." ) ?;
379
+ . await
380
+ . context ( "Error occurred while setting review preferences." ) ?;
377
381
tracing:: info!( "Setting rotation mode `{gh_username}` to {rotation_mode:?}" ) ;
378
382
format ! (
379
- "Rotation mode set to {rotation_mode:?}"
383
+ "Rotation mode set to {}" ,
384
+ match rotation_mode {
385
+ RotationMode :: OnRotation => "*on rotation*" ,
386
+ RotationMode :: OffRotation => "*off rotation*." ,
387
+ }
380
388
)
381
389
}
382
- "help" => r"`work show`: show your assigned PRs
383
- `work set-pr-limit <number>|unlimited`: set the maximum number of PRs you can be assigned to
384
- `work set-rotation-mode <off|on>`: configure if you are *on* rotation or *off* rotation (e.g. when you are on a vacation)
385
- "
386
- . to_string ( ) ,
390
+ "help" => WORKQUEUE_HELP . to_string ( ) ,
387
391
_ => anyhow:: bail!( "Invalid subcommand." ) ,
388
392
} ;
389
393
0 commit comments