Skip to content

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

Merged
iamrajjoshi merged 5 commits intomasterfrom
raj/update-help-for-ids
Jul 17, 2024
Merged

docs(id-support): Document that -p and -o arguments accept slugs and IDs#2101
iamrajjoshi merged 5 commits intomasterfrom
raj/update-help-for-ids

Conversation

@iamrajjoshi
Copy link
Contributor

@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!

#[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
.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.

Co-authored-by: Daniel Szoke <7881302+szokeasaurusrex@users.noreply.github.com>
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!

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

|| 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