-
-
Notifications
You must be signed in to change notification settings - Fork 235
feat(mobile-app): Add new VCS params to mobile-app command #2682
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
feat(mobile-app): Add new VCS params to mobile-app command #2682
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
API lgtm
dd65d3b
to
38b2596
Compare
src/commands/mobile_app/upload.rs
Outdated
.map(Cow::Borrowed) | ||
.or_else(|| vcs::find_head().ok().map(Cow::Owned)); | ||
|
||
// TODO: Implement default values |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will follow in future PRs for each of these individually.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am okay with us doing this in future PRs; however, I would prefer not to commit the TODO
comment, lest we ever forget to remove it. We should track the work in GitHub/Linear issues instead
// TODO: Implement default values |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, besides a few minor suggestions to address prior to merge
#[serde(skip_serializing_if = "Option::is_none")] | ||
pub base_ref: Option<&'a str>, | ||
#[serde(skip_serializing_if = "Option::is_none")] | ||
pub pr_number: Option<i32>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As PR's can only have positive numbers, I would use an unsigned integer (u32
) here, rather than a signed integer
pub pr_number: Option<i32>, | |
pub pr_number: Option<u32>, |
src/commands/mobile_app/upload.rs
Outdated
.map(Cow::Borrowed) | ||
.or_else(|| vcs::find_head().ok().map(Cow::Owned)); | ||
|
||
// TODO: Implement default values |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am okay with us doing this in future PRs; however, I would prefer not to commit the TODO
comment, lest we ever forget to remove it. We should track the work in GitHub/Linear issues instead
// TODO: Implement default values |
Arg::new("pr_number") | ||
.long("pr-number") | ||
.help("The pull request number to use for the upload. If not provided, the current pull request number will be used.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This way, Clap can parse straight to a u32
and perform the validation internally
Arg::new("pr_number") | |
.long("pr-number") | |
.help("The pull request number to use for the upload. If not provided, the current pull request number will be used.") | |
Arg::new("pr_number") | |
.long("pr-number") | |
.value_parser(clap::value_parser!(u32)) | |
.help("The pull request number to use for the upload. If not provided, the current pull request number will be used.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice to know, figured there was a way to do this I was missing
src/commands/mobile_app/upload.rs
Outdated
let pr_number = matches | ||
.get_one("pr_number") | ||
.map(String::as_str) | ||
.and_then(|s| s.parse::<i32>().ok()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once you change the pr_number
's type to u32
in the struct, and once you add the value_parser
above, you will be able to simplify this line greatly:
let pr_number = matches | |
.get_one("pr_number") | |
.map(String::as_str) | |
.and_then(|s| s.parse::<i32>().ok()); | |
let pr_number = matches.get_one("pr_number"); |
e9979f6
to
c5ecf09
Compare
Adds new VCS params as args to the
mobile-app
command and passes them to the API (pending getsentry/sentry#97332). Notably removessha
in favor ofhead_sha
. Given this command is still unreleased and marked experimental, this would usually be a breaking change but I don't believe we need any backwards compatibility here.We'll implement default value providing for most of these as well in follow ups, as I'd prefer to silo those implementations for easier review && testing.