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

Method run

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

Source from the content-addressed store, hash-verified

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

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