| 533 | } |
| 534 | |
| 535 | fn write_output(&mut self, data: &[u8]) -> std::io::Result<()> { |
| 536 | use Command::{Collect, Compile, Debug, Experimental, Lex, Parse}; |
| 537 | let mut output = match self { |
| 538 | Parse { io_args, .. } |
| 539 | | Lex { io_args, .. } |
| 540 | | Collect(io_args) |
| 541 | | Compile { io_args, .. } |
| 542 | | Debug(DebugCommand::Annotate(io_args) | DebugCommand::Lineage { io_args, .. }) => { |
| 543 | io_args.output.clone() |
| 544 | } |
| 545 | Experimental(ExperimentalCommand::GenerateDocs { io_args, .. }) => { |
| 546 | io_args.output.clone() |
| 547 | } |
| 548 | Experimental(ExperimentalCommand::Highlight(io_args)) => io_args.output.clone(), |
| 549 | _ => unreachable!(), |
| 550 | }; |
| 551 | output.write_all(data) |
| 552 | } |
| 553 | } |
| 554 | |
| 555 | fn has_debug_log(cli: &Cli) -> bool { |