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

docs(id-support): Document that -p and -o arguments accept slugs and IDs #2101

Merged
merged 5 commits into from
Jul 17, 2024

Conversation

iamrajjoshi
Copy link
Member

@iamrajjoshi iamrajjoshi commented Jul 16, 2024

With the API changes we made to support ids as well as slugs, we get the added bonus that our CLI can also support ids.

Turns out the CLI also uses a couple endpoints which passed project slug in the body parameter, so we also had to update them:
getsentry/sentry#74232
getsentry/sentry#74371

With these prs, all the endpoints the CLI uses have ID support.

@szokeasaurusrex and I had a conversation about how we would like to roll this change out in an earlier closed pr, and decided that once we support ids in all the CLI commands, we can change all the help strings at once, which is what i am doing here.

@iamrajjoshi iamrajjoshi self-assigned this Jul 17, 2024
@iamrajjoshi iamrajjoshi marked this pull request as ready for review July 17, 2024 06:50
Copy link
Member

@szokeasaurusrex szokeasaurusrex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks for making these changes!

Before merging, please update "id" so that it is consistently capitalized, like "ID". Then, I will approve this PR!

@@ -24,7 +24,7 @@ pub(in crate::api) enum ApiErrorKind {
OrganizationNotFound,
#[error("resource not found")]
ResourceNotFound,
#[error("Project not found. Please check that you entered the project and organization slugs correctly.")]
#[error("Project not found. Please check that you entered the project and organization ids or slugs correctly.")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#[error("Project not found. Please check that you entered the project and organization ids or slugs correctly.")]
#[error("Project not found. Please check that you entered the project and organization IDs or slugs correctly.")]

src/config.rs Outdated
@@ -339,7 +339,7 @@ impl Config {
.get_from(Some("defaults"), "org")
.map(str::to_owned)
.ok_or_else(|| {
format_err!("An organization slug is required (provide with --org)")
format_err!("An organization id or slug is required (provide with --org)")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
format_err!("An organization id or slug is required (provide with --org)")
format_err!("An organization ID or slug is required (provide with --org)")

Please update anywhere else you have used lowercase id.

src/config.rs Outdated Show resolved Hide resolved
Co-authored-by: Daniel Szoke <[email protected]>
Copy link
Member

@szokeasaurusrex szokeasaurusrex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more suggestion, otherwise this looks good. Much simpler than your previous PR – thanks for getting the rest of the endpoints updated!

@@ -4,7 +4,7 @@ use clap::{Arg, ArgAction, Command};

fn validate_org(v: &str) -> Result<String, String> {
if v.contains('/') || v == "." || v == ".." || v.contains(' ') {
Err("Invalid value for organization. Use the URL slug and not the name!".to_string())
Err("Invalid value for organization. Use the URL slug or the ID and not the name!".to_string())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Err("Invalid value for organization. Use the URL slug or the ID and not the name!".to_string())
Err("Invalid value for organization. Use the URL slug or the ID, not the name!".to_string())

Think this would read more clearly

@@ -19,7 +19,7 @@ pub fn validate_project(v: &str) -> Result<String, String> {
|| v.contains('\t')
|| v.contains('\r')
{
Err("Invalid value for project. Use the URL slug and not the name!".to_string())
Err("Invalid value for project. Use the URL slug or the ID and not the name!".to_string())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Err("Invalid value for project. Use the URL slug or the ID and not the name!".to_string())
Err("Invalid value for project. Use the URL slug or the ID, not the name!".to_string())

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants