(context: &ProjectRegistryContext, json_output: bool)
| 137 | } |
| 138 | |
| 139 | fn print_project_context(context: &ProjectRegistryContext, json_output: bool) -> Result<()> { |
| 140 | if json_output { |
| 141 | println!("{}", serde_json::to_string_pretty(context)?); |
| 142 | return Ok(()); |
| 143 | } |
| 144 | |
| 145 | let project = &context.project; |
| 146 | println!("Project: {}", project.project_id); |
| 147 | println!("root: {}", project.display_root); |
| 148 | if let Some(branch) = &project.default_branch { |
| 149 | println!("default branch: {branch}"); |
| 150 | } |
| 151 | if let Some(remote) = &project.git_remote_url { |
| 152 | println!("remote: {remote}"); |
| 153 | } |
| 154 | if let Some(git_common_dir) = &project.git_common_dir { |
| 155 | println!("git common dir: {git_common_dir}"); |
| 156 | } |
| 157 | println!("last seen: {}", project.last_seen_at); |
| 158 | |
| 159 | if !context.aliases.is_empty() { |
| 160 | println!(); |
| 161 | println!("Aliases:"); |
| 162 | for alias in &context.aliases { |
| 163 | println!(" {}", alias.alias_path); |
| 164 | } |
| 165 | } |
| 166 | |
| 167 | if !context.stores.is_empty() { |
| 168 | println!(); |
| 169 | println!("Stores:"); |
| 170 | for store_context in &context.stores { |
| 171 | let store = &store_context.store; |
| 172 | println!( |
| 173 | " {} [{} / {}] {}", |
| 174 | store.store_id, store.store_kind, store.storage_mode, store.store_relpath |
| 175 | ); |
| 176 | for scope in &store_context.graph_scopes { |
| 177 | println!( |
| 178 | " scope {} branch={} db={} writable={}", |
| 179 | scope.graph_scope_id, scope.branch_name, scope.db_relpath, scope.writable |
| 180 | ); |
| 181 | } |
| 182 | for artifact in &store_context.artifacts { |
| 183 | let size = artifact |
| 184 | .size_bytes |
| 185 | .map(|bytes| bytes.to_string()) |
| 186 | .unwrap_or_else(|| "-".to_string()); |
| 187 | println!( |
| 188 | " artifact {} path={} size={}", |
| 189 | artifact.artifact_kind, artifact.relpath, size |
| 190 | ); |
| 191 | } |
| 192 | } |
| 193 | } |
| 194 | Ok(()) |
| 195 | } |
no test coverage detected