fix(bug-report): verify exit code of open, always print url (#1839)

* fix(bug-report): verify exit code of browser open

* always print url to open ticket
This commit is contained in:
David Knaack 2020-10-30 18:36:12 +01:00 committed by GitHub
parent c6d25a6a38
commit ffac28745b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 7 deletions

View File

@ -19,16 +19,19 @@ pub fn create() {
}; };
let link = make_github_issue_link(crate_version!(), environment); let link = make_github_issue_link(crate_version!(), environment);
let short_link = shorten_link(&link);
if open::that(&link).is_ok() { if open::that(&link)
print!("Take a look at your browser. A GitHub issue has been populated with your configuration") .map(|status| status.success())
.unwrap_or(false)
{
println!("Take a look at your browser. A GitHub issue has been populated with your configuration.");
println!("If your browser has failed to open, please click this link:\n");
} else { } else {
let link = shorten_link(&link).unwrap_or(link); println!("Click this link to create a GitHub issue populated with your configuration:\n");
println!(
"Click this link to create a GitHub issue populated with your configuration:\n\n {}",
link
);
} }
println!(" {}", short_link.unwrap_or(link));
} }
#[cfg(feature = "http")] #[cfg(feature = "http")]