Optionally switch to the new view and print hint.
(&self, name: &str, repo: &mut Repository)
| 300 | |
| 301 | /// Optionally switch to the new view and print hint. |
| 302 | fn maybe_switch(&self, name: &str, repo: &mut Repository) -> CliResult<()> { |
| 303 | if self.switch { |
| 304 | let result = repo.switch_view(name).map_err(CliError::Repository)?; |
| 305 | print_success(&format!( |
| 306 | "Switched to view: {} ({} files updated)", |
| 307 | style_view(name), |
| 308 | result.files_written, |
| 309 | )); |
| 310 | } else { |
| 311 | print_hint(&format!( |
| 312 | "Use 'atomic view switch {}' to switch to the new view", |
| 313 | name |
| 314 | )); |
| 315 | } |
| 316 | Ok(()) |
| 317 | } |
| 318 | } |
| 319 | |
| 320 | impl Command for New { |
no test coverage detected