(&self)
| 40 | |
| 41 | impl 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 | } |
nothing calls this directly
no test coverage detected