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

Method maybe_switch

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

Optionally switch to the new draft view.

(&self, repo: &mut Repository, working_copy: WorkingCopyId)

Source from the content-addressed store, hash-verified

380
381 /// Optionally switch to the new draft view.
382 fn maybe_switch(&self, repo: &mut Repository, working_copy: WorkingCopyId) -> CliResult<()> {
383 if self.switch {
384 let result = repo
385 .switch_view(working_copy, &self.name)
386 .map_err(CliError::Repository)?;
387 print_success(&format!(
388 "Switched to view: {} ({} files updated)",
389 style_view(&self.name),
390 result.files_written,
391 ));
392 } else {
393 print_hint(&format!(
394 "Use 'atomic view switch {}' to switch to the new draft",
395 self.name
396 ));
397 }
398 Ok(())
399 }
400}
401
402#[cfg(test)]

Callers 1

Calls 3

print_successFunction · 0.85
print_hintFunction · 0.85
switch_viewMethod · 0.45

Tested by

no test coverage detected