intermodal/bin/gen/src/summary.rs
Casey Rodarmor 04338e3501
Merge documentation and changelog generation
Merge documentation generation into a single binary, `bin/gen`. This
includes: The changelog, man pages, the readme, and the book.

type: reform
2020-04-17 21:31:54 -07:00

30 lines
558 B
Rust

use crate::common::*;
#[derive(Template)]
#[template(path = "SUMMARY.md")]
pub(crate) struct Summary {
pub(crate) commands: String,
}
impl Summary {
pub(crate) fn new(bin: &Bin) -> Summary {
let mut lines = Vec::new();
lines.push("- [Commands](./commands.md)".to_string());
for subcommand in &bin.subcommands {
let slug = subcommand.slug();
lines.push(format!(
" - [`{}`](./commands/{}.md)",
subcommand.command_line(),
slug
))
}
Summary {
commands: lines.join("\n"),
}
}
}