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

Method maybe_switch

atomic-cli/src/commands/view/new.rs:302–317  ·  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

300
301 /// Optionally switch to the new view and print hint.
302 fn maybe_switch(&self, name: &str, repo: &mut Repository) -> CliResult<()> {
303 if self.switch {
304 let result = repo.switch_view(name).map_err(CliError::Repository)?;
305 print_success(&format!(
306 "Switched to view: {} ({} files updated)",
307 style_view(name),
308 result.files_written,
309 ));
310 } else {
311 print_hint(&format!(
312 "Use 'atomic view switch {}' to switch to the new view",
313 name
314 ));
315 }
316 Ok(())
317 }
318}
319
320impl Command for New {

Callers 2

run_two_tierMethod · 0.45
runMethod · 0.45

Calls 3

print_successFunction · 0.85
print_hintFunction · 0.85
switch_viewMethod · 0.80

Tested by

no test coverage detected