Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prompt private or public on creation #210

Merged
merged 3 commits into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions crates/api-client/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -3358,6 +3358,10 @@
"description": {
"type": "string",
"description": "Description of the component."
},
"public": {
"type": "boolean",
"description": "Whether the created component is public or not."
}
},
"required": [
Expand Down
16 changes: 14 additions & 2 deletions crates/cli/src/commands/components/push.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub struct Options {
}

pub async fn run(opts: Options) -> anyhow::Result<()> {
use inquire::{Confirm, Editor};
use inquire::{Confirm, Editor, Select};

use edgee_api_client::{auth::Credentials, ResultExt};

Expand Down Expand Up @@ -64,6 +64,12 @@ pub async fn run(opts: Options) -> anyhow::Result<()> {
return Ok(());
}

let public = Select::new(
"Would you like to make this component public or private?",
vec!["private", "public"],
)
.prompt()?;

client
.create_component()
.body(
Expand All @@ -86,11 +92,17 @@ pub async fn run(opts: Options) -> anyhow::Result<()> {
.repository
.as_ref()
.map(|url| url.to_string()),
),
)
.public(public == "public"),
)
.send()
.await
.api_context("Could not create component")?;
tracing::info!(
"Component `{}/{}` created successfully!",
organization.slug,
manifest.package.name
);
}
Ok(_) | Err(_) => {}
}
Expand Down