Optionally switch to the new view and print hint.
(&self, name: &str, repo: &mut Repository)
| 255 | |
| 256 | /// Optionally switch to the new view and print hint. |
| 257 | fn maybe_switch(&self, name: &str, repo: &mut Repository) -> CliResult<()> { |
| 258 | if self.switch { |
| 259 | let result = repo.switch_view(name).map_err(CliError::Repository)?; |
| 260 | print_success(&format!( |
| 261 | "Switched to view: {} ({} files updated)", |
| 262 | style_view(name), |
| 263 | result.files_written, |
| 264 | )); |
| 265 | } else { |
| 266 | print_hint(&format!( |
| 267 | "Use 'atomic view switch {}' to switch to the new view", |
| 268 | name |
| 269 | )); |
| 270 | } |
| 271 | Ok(()) |
| 272 | } |
| 273 | } |
| 274 | |
| 275 | impl Command for New { |
no test coverage detected