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

Method maybe_switch

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

255
256 /// Optionally switch to the new view and print hint.
257 fn maybe_switch(&self, name: &str, repo: &mut Repository) -> CliResult<()> {
258 if self.switch {
259 let result = repo.switch_view(name).map_err(CliError::Repository)?;
260 print_success(&format!(
261 "Switched to view: {} ({} files updated)",
262 style_view(name),
263 result.files_written,
264 ));
265 } else {
266 print_hint(&format!(
267 "Use 'atomic view switch {}' to switch to the new view",
268 name
269 ));
270 }
271 Ok(())
272 }
273}
274
275impl Command for New {

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