Skip to content

Commit

Permalink
Format dependency copyrights in generate-copyright as a table
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanpallant committed Jul 8, 2024
1 parent facf8fa commit 485ad80
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/tools/generate-copyright/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,19 @@ fn render_deps<'a, 'b>(
deps: impl Iterator<Item = &'a cargo_metadata::Dependency>,
buffer: &'b mut Vec<u8>,
) -> Result<(), Error> {
writeln!(buffer, "| Package | License | URL | Authors |")?;
writeln!(buffer, "|---------|---------|-----|---------|")?;
for dep in deps {
let authors_list = dep.authors.join(", ");
let authors_list = dep.authors.join(", ").replace("<", "\\<").replace(">", "\\>");
let url = format!("https://crates.io/crates/{}/{}", dep.name, dep.version);
writeln!(
buffer,
"* [{} {}]({}) ({}), by {}",
dep.name, dep.version, url, dep.license, authors_list
"| {name} {version} | {license} | <{url}> | {authors} |",
name = dep.name,
version = dep.version,
license = dep.license,
url = url,
authors = authors_list
)?;
}
Ok(())
Expand Down

0 comments on commit 485ad80

Please sign in to comment.