File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -298,13 +298,21 @@ fn spawn_watch_shell(
298
298
println ! ( "Bye!" ) ;
299
299
} else if input. eq ( "help" ) {
300
300
println ! ( "Commands available to you in watch mode:" ) ;
301
- println ! ( " hint - prints the current exercise's hint" ) ;
302
- println ! ( " clear - clears the screen" ) ;
303
- println ! ( " quit - quits watch mode" ) ;
304
- println ! ( " help - displays this help message" ) ;
301
+ println ! ( " hint - prints the current exercise's hint" ) ;
302
+ println ! ( " clear - clears the screen" ) ;
303
+ println ! ( " quit - quits watch mode" ) ;
304
+ println ! ( " !<cmd> - executes a command, like `!rustc --explain E0381`" ) ;
305
+ println ! ( " help - displays this help message" ) ;
305
306
println ! ( ) ;
306
307
println ! ( "Watch mode automatically re-evaluates the current exercise" ) ;
307
308
println ! ( "when you edit a file's contents." )
309
+ } else if let Some ( cmd) = input. strip_prefix ( '!' ) {
310
+ let parts: Vec < & str > = cmd. split_whitespace ( ) . collect ( ) ;
311
+ if parts. is_empty ( ) {
312
+ println ! ( "no command provided" ) ;
313
+ } else if let Err ( e) = Command :: new ( parts[ 0 ] ) . args ( & parts[ 1 ..] ) . status ( ) {
314
+ println ! ( "failed to execute command `{}`: {}" , cmd, e) ;
315
+ }
308
316
} else {
309
317
println ! ( "unknown command: {input}" ) ;
310
318
}
You can’t perform that action at this time.
0 commit comments