(args: &IncrementalArgs)
| 98 | } |
| 99 | |
| 100 | pub fn run(args: &IncrementalArgs) -> CliResult<()> { |
| 101 | let root = find_repository_root()?; |
| 102 | let thinking = super::progress::Thinking::start(args.json || args.html); |
| 103 | let report = crate::commands::rpc::review(&request(args)?)?; |
| 104 | drop(thinking); |
| 105 | if args.html { |
| 106 | let repo = |
| 107 | crate::commands::open_readonly_repository(&root).map_err(CliError::Repository)?; |
| 108 | let html = super::html::render(&repo, &report)?; |
| 109 | if !args.no_open { |
| 110 | crate::output::html::write_and_open_html(&html, args.output.as_deref(), |url| { |
| 111 | open::that(url) |
| 112 | })?; |
| 113 | } else if let Some(path) = &args.output { |
| 114 | std::fs::write(path, html)?; |
| 115 | } else { |
| 116 | print!("{html}"); |
| 117 | } |
| 118 | } else if args.json { |
| 119 | println!( |
| 120 | "{}", |
| 121 | serde_json::to_string_pretty(&report).map_err(|e| CliError::Internal(e.into()))? |
| 122 | ); |
| 123 | } else { |
| 124 | print!( |
| 125 | "{}", |
| 126 | libatomic::review::incremental::render(&report, args.details)? |
| 127 | ); |
| 128 | } |
| 129 | Ok(()) |
| 130 | } |
| 131 | |
| 132 | #[cfg(test)] |
| 133 | mod tests { |
nothing calls this directly
no test coverage detected