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

Method maybe_switch

atomic-cli/src/commands/view/new.rs:299–314  ·  view source on GitHub ↗

Optionally switch to the new view and print hint.

(&self, name: &str, repo: &mut Repository)

Source from the content-addressed store, hash-verified

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
317impl Command for New {

Callers 2

run_two_tierMethod · 0.80
runMethod · 0.80

Calls 3

print_successFunction · 0.85
print_hintFunction · 0.85
switch_viewMethod · 0.80

Tested by

no test coverage detected