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

Method execute

atomic-cli/src/commands/org/create.rs:81–121  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

79
80impl OrgCreate {
81 async fn execute(&self) -> CliResult<()> {
82 // Build an apex client (no org subdomain). `POST /orgs` is an apex
83 // endpoint that spans orgs, so it must be hit on the bare server host —
84 // and crucially this works even when no default org is configured yet.
85 let client = build_apex_client(None).await?;
86
87 let info = atomic_teams::org::create_org(&client, &self.name, self.email.as_deref())
88 .await
89 .map_err(|e| CliError::RemoteError {
90 message: e.to_string(),
91 url: None,
92 })?;
93
94 print_success(&format!("Created organization: {}", info.slug));
95 println!();
96
97 let table = KeyValueTable::new()
98 .add("Name", &info.name)
99 .add("Slug", &info.slug)
100 .add("Kind", &info.kind)
101 .add("Plan", &info.plan);
102 let table = if let Some(email) = &info.email {
103 table.add("Email", email)
104 } else {
105 table
106 };
107 let table = table.add("ID", info.id.to_string());
108
109 println!("{table}");
110
111 print_next_steps(&[
112 (
113 &format!("atomic org set {}", info.slug),
114 "Set as your default org",
115 ),
116 ("atomic org member add <id>", "Add members to the org"),
117 ("atomic team create <name>", "Create a team"),
118 ]);
119
120 Ok(())
121 }
122}
123
124#[cfg(test)]

Callers 1

runMethod · 0.45

Calls 5

build_apex_clientFunction · 0.85
create_orgFunction · 0.85
print_successFunction · 0.85
print_next_stepsFunction · 0.85
addMethod · 0.45

Tested by

no test coverage detected