mirror of
https://github.com/clap-rs/clap
synced 2024-11-10 14:54:15 +00:00
fix(man): Expose title generation
This commit is contained in:
parent
2fdb9a3d54
commit
b16cfeecdc
1 changed files with 12 additions and 1 deletions
|
@ -78,7 +78,7 @@ impl<'a> Man<'a> {
|
|||
/// Render a manual page into writer.
|
||||
pub fn render(&self, w: &mut dyn Write) -> Result<(), std::io::Error> {
|
||||
let mut roff = Roff::default();
|
||||
roff.control("TH", self.title_args());
|
||||
self._render_title(&mut roff);
|
||||
self._render_name_section(&mut roff);
|
||||
self._render_synopsis_section(&mut roff);
|
||||
self._render_description_section(&mut roff);
|
||||
|
@ -106,6 +106,17 @@ impl<'a> Man<'a> {
|
|||
roff.to_writer(w)
|
||||
}
|
||||
|
||||
/// Render the title into the writer.
|
||||
pub fn render_title(&self, w: &mut dyn Write) -> Result<(), std::io::Error> {
|
||||
let mut roff = Roff::default();
|
||||
self._render_title(&mut roff);
|
||||
roff.to_writer(w)
|
||||
}
|
||||
|
||||
fn _render_title(&self, roff: &mut Roff) {
|
||||
roff.control("TH", self.title_args());
|
||||
}
|
||||
|
||||
// Turn metadata into arguments for a .TH macro.
|
||||
fn title_args(&self) -> Vec<&str> {
|
||||
vec![
|
||||
|
|
Loading…
Reference in a new issue