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

Method maybe_switch

atomic-cli/src/commands/view/new.rs:299–310  ·  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 repo.set_current_view(name).map_err(CliError::Repository)?;
302 print_success(&format!("Switched to view: {}", style_view(name)));
303 } else {
304 print_hint(&format!(
305 "Use 'atomic view switch {}' to switch to the new view",
306 name
307 ));
308 }
309 Ok(())
310 }
311}
312
313impl Command for New {

Callers 2

run_two_tierMethod · 0.80
runMethod · 0.80

Calls 3

print_successFunction · 0.85
print_hintFunction · 0.85
set_current_viewMethod · 0.80

Tested by

no test coverage detected