MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / maybe_switch

Method maybe_switch

atomic-cli/src/commands/view/split.rs:249–264  ·  view source on GitHub ↗

Optionally switch to the new draft view.

(&self, repo: &mut Repository)

Source from the content-addressed store, hash-verified

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)]

Callers 1

runMethod · 0.45

Calls 3

print_successFunction · 0.85
print_hintFunction · 0.85
switch_viewMethod · 0.80

Tested by

no test coverage detected