Skip to content

Commit 397fd6a

Browse files
committed
Update agenda generator.
1 parent 4888fc9 commit 397fd6a

File tree

1 file changed

+29
-12
lines changed

1 file changed

+29
-12
lines changed

tools/agenda-generator/src/generator.rs

+29-12
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,22 @@ pub struct Generator {
1616
seen: BTreeSet<String>,
1717
}
1818

19+
fn shorten(url: &str) -> String {
20+
if let Some(num) = url.strip_prefix("https://github.com/rust-lang/rust/issues/") {
21+
format!("rust.tf/{num}")
22+
} else if let Some(num) = url.strip_prefix("https://github.com/rust-lang/rust/pull/") {
23+
format!("rust.tf/{num}")
24+
} else if let Some(num) = url.strip_prefix("https://github.com/rust-lang/rfcs/issues/") {
25+
format!("rust.tf/rfc{num}")
26+
} else if let Some(num) = url.strip_prefix("https://github.com/rust-lang/rfcs/pull/") {
27+
format!("rust.tf/rfc{num}")
28+
} else if let Some(url) = url.strip_prefix("https://") {
29+
url.to_string()
30+
} else {
31+
url.to_string()
32+
}
33+
}
34+
1935
impl Generator {
2036
pub fn libs_api_agenda(mut self) -> Result<String> {
2137
writeln!(
@@ -309,27 +325,26 @@ impl Generator {
309325

310326
writeln!(self.agenda, "### FCPs")?;
311327
writeln!(self.agenda,)?;
312-
writeln!(self.agenda, "{} open {} FCPs:", fcps.len(), label)?;
313328

314329
for repo in repos {
315330
let fcps = fcps
316331
.iter()
317332
.filter(|fcp| fcp.issue.repository == repo)
318333
.collect::<Vec<_>>();
319334

320-
writeln!(self.agenda, "<details><summary><a href=\"https://github.com/{}/issues?q=is%3Aopen+label%3AT-libs-api+label%3Aproposed-final-comment-period\">{} <code>{}</code> FCPs</a></summary>\n", repo, fcps.len(), repo)?;
335+
//writeln!(self.agenda, "<details><summary><a href=\"https://github.com/{}/issues?q=is%3Aopen+label%3AT-libs-api+label%3Aproposed-final-comment-period\">{} <code>{}</code> FCPs</a></summary>\n", repo, fcps.len(), repo)?;
336+
337+
writeln!(self.agenda, "{} {} {} FCPs\n", fcps.len(), repo, label)?;
321338

322339
for fcp in fcps {
323-
let url = format!(
324-
"https://github.com/{}/issues/{}#issuecomment-{}",
325-
fcp.issue.repository, fcp.issue.number, fcp.status_comment.id
326-
);
340+
let url = shorten(&format!(
341+
"https://github.com/{}/issues/{}", //#issuecomment-{}",
342+
fcp.issue.repository, fcp.issue.number, // fcp.status_comment.id
343+
));
327344
write!(
328345
self.agenda,
329-
" - [[{} {}]({})] *{}*",
346+
" - {} {url} *{}*",
330347
fcp.fcp.disposition,
331-
fcp.issue.number,
332-
url,
333348
escape(&fcp.issue.title)
334349
)?;
335350
let needed = fcp.reviews.iter().filter(|review| !review.1).count();
@@ -340,10 +355,12 @@ impl Generator {
340355
// writeln!(self.agenda, " Blocked on an open concern.")?;
341356
// }
342357
}
343-
writeln!(self.agenda, "</details>")?;
358+
359+
writeln!(self.agenda)?;
360+
//writeln!(self.agenda, "</details>")?;
344361
}
345362

346-
writeln!(self.agenda, "<p></p>\n")?;
363+
//writeln!(self.agenda, "<p></p>\n")?;
347364

348365
for (i, (&reviewer, &num)) in reviewer_count.iter().enumerate() {
349366
if i != 0 {
@@ -363,7 +380,7 @@ impl Generator {
363380

364381
fn write_issues(&mut self, issues: &[Issue]) -> Result<()> {
365382
for issue in issues.iter().rev() {
366-
write!(self.agenda, " - [[{}]({})]", issue.number, issue.html_url,)?;
383+
write!(self.agenda, " - {}", shorten(&issue.html_url))?;
367384
for label in issue.labels.iter().filter(|s| s.starts_with("P-")) {
368385
write!(self.agenda, " `{}`", label)?;
369386
}

0 commit comments

Comments
 (0)