1 unstable release
0.1.0 | Jun 2, 2021 |
---|
#10 in #github-issues
15KB
104 lines
GitHub Issue URL
GitHub prefilled issue URL builder
Motivation
You can have issue form fields prefilled by specifying certain query parameters in the "New Issue" URL (https://github.com/<User | Organization>//issues/new).
For example:
https://github.com/EstebanBorai/github-issue-url/issues/new?
title=Null%3A+The+Billion+Dollar+Mistake
&body=Null+is+a+flag.+It+represents+different+situations
&template=bug_report.md
&labels=bug%2Cproduction%2Chigh-severity
&assignee=EstebanBorai
&milestone=1
&projects=1
This way you can provide a one click "Open Issue" button to your Rust applications, for instance you could have some stack trace, or details read from the host system where your application is running to let the user open an issue on GitHub without the need of specifying system /or application details themselves.
Installation
[dependencies]
github-issue-url = "0.1"
Usage
To create a URL like the one shown above you must use the Issue
struct included
in this crate, specify the repository owner and the repository name, and then
define the relevant fields such as title, body, template, labels, assginee,
milestone and/or projects, using the "setter-like" methods.
use github_issue_url::Issue;
const GITHUB_ISSUE_LINK: &str = "https://github.com/EstebanBorai/github-issue-url/issues/new?title=Null%3A+The+Billion+Dollar+Mistake&body=Null+is+a+flag.+It+represents+different+situations+depending+on+the+context+in+which+it+is+used+and+invoked.+This+yields+the+most+serious+error+in+software+development%3A+Coupling+a+hidden+decision+in+the+contract+between+an+object+and+who+uses+it.&template=bug_report.md&labels=bug%2Cproduction%2Chigh-severity&assignee=EstebanBorai&milestone=1&projects=1";
let mut have = Issue::new("github-issue-url", "EstebanBorai").unwrap();
have.title("Null: The Billion Dollar Mistake");
have.body(SAMPLE_ISSUE_BODY);
have.template("bug_report.md");
have.labels("bug,production,high-severity");
have.assignee("EstebanBorai");
have.milestone("1");
have.projects("1");
let have = have.url().unwrap();
assert_eq!(have, GITHUB_ISSUE_LINK.to_string());
Release
git tag -a v0.1.0 -m "Release Message"
git push origin main --follow-tags
Contributing
Every contribution to this project is welcome! Feel free to open a pull request or an issue.
License
Licensed under both the MIT License and the Apache 2.0 License.
Dependencies
~2–3MB
~56K SLoC