Optionally switch to the new draft view.
(&self, repo: &mut Repository)
| 247 | |
| 248 | /// Optionally switch to the new draft view. |
| 249 | fn maybe_switch(&self, repo: &mut Repository) -> CliResult<()> { |
| 250 | if self.switch { |
| 251 | let result = repo.switch_view(&self.name).map_err(CliError::Repository)?; |
| 252 | print_success(&format!( |
| 253 | "Switched to view: {} ({} files updated)", |
| 254 | style_view(&self.name), |
| 255 | result.files_written, |
| 256 | )); |
| 257 | } else { |
| 258 | print_hint(&format!( |
| 259 | "Use 'atomic view switch {}' to switch to the new draft", |
| 260 | self.name |
| 261 | )); |
| 262 | } |
| 263 | Ok(()) |
| 264 | } |
| 265 | } |
| 266 | |
| 267 | #[cfg(test)] |
no test coverage detected