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

Method run

atomic-cli/src/commands/project/show.rs:75–119  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

73
74impl Command for ProjectShow {
75 fn run(&self) -> CliResult<()> {
76 let rt = tokio::runtime::Runtime::new().map_err(|e| {
77 CliError::Internal(anyhow::anyhow!("Failed to create async runtime: {}", e))
78 })?;
79
80 rt.block_on(async {
81 let (ws_slug, proj_slug) = parse_project_path(&self.slug)?;
82 let client = build_client(self.org.as_deref(), None).await?;
83
84 let project = client
85 .get_project(ws_slug, proj_slug)
86 .await
87 .map_err(remote_err)?;
88
89 if self.format == "json" {
90 println!(
91 "{}",
92 serde_json::to_string_pretty(&project).unwrap_or_default()
93 );
94 return Ok(());
95 }
96
97 // Build VCS URL
98 let vcs_url = format!(
99 "{}/workspaces/{}/projects/{}/code",
100 client.base_url(),
101 ws_slug,
102 proj_slug,
103 );
104
105 let table = KeyValueTable::new()
106 .add("Name", &project.name)
107 .add("Slug", &project.slug)
108 .add("Workspace", project.workspace_id.to_string())
109 .add("View", &project.default_view)
110 .add("Visibility", project.visibility.to_string())
111 .add("Description", project.description.as_deref().unwrap_or("—"))
112 .add("VCS URL", &vcs_url)
113 .add("Created", format_timestamp(&project.created_at))
114 .add("Updated", format_timestamp(&project.updated_at));
115
116 println!("{}", table);
117 Ok(())
118 })
119 }
120}
121
122#[cfg(test)]

Callers

nothing calls this directly

Calls 5

parse_project_pathFunction · 0.85
build_clientFunction · 0.85
format_timestampFunction · 0.85
get_projectMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected