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