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

Method run

atomic-cli/src/commands/view/promote.rs:42–76  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

40
41impl Command for Promote {
42 fn run(&self) -> CliResult<()> {
43 let root = find_repository_root()?;
44 let repo = Repository::open(&root).map_err(|e| CliError::InvalidRepository {
45 reason: e.to_string(),
46 })?;
47
48 let view_name = match &self.name {
49 Some(name) => name.clone(),
50 None => repo.current_view().to_string(),
51 };
52
53 let info = repo
54 .get_view_info(&view_name)
55 .map_err(|e| CliError::Internal(e.into()))?;
56
57 if info.scope.is_shared() && info.parent_name.is_none() {
58 print_info(&format!(
59 "View '{}' is already a shared root view",
60 view_name
61 ));
62 return Ok(());
63 }
64
65 repo.set_view_scope(&view_name, ViewScope::Shared)
66 .map_err(|e| CliError::Internal(e.into()))?;
67
68 print_success(&format!(
69 "Promoted '{}' to shared root view (was {:?}, parent: {:?})",
70 view_name,
71 info.scope,
72 info.parent_name.as_deref().unwrap_or("none"),
73 ));
74
75 Ok(())
76 }
77}

Callers

nothing calls this directly

Calls 9

find_repository_rootFunction · 0.85
print_infoFunction · 0.85
print_successFunction · 0.85
current_viewMethod · 0.80
get_view_infoMethod · 0.80
is_sharedMethod · 0.80
is_noneMethod · 0.80
set_view_scopeMethod · 0.80
cloneMethod · 0.45

Tested by

no test coverage detected