Struct clap_mangen::Man

source ·
pub struct Man { /* private fields */ }
Expand description

A manpage writer

Implementations§

source§

impl Man

Build a Man

source

pub fn new(cmd: Command) -> Self

Create a new manual page.

source

pub fn title(self, title: impl Into<String>) -> Self

Override the default man page title, written in all caps

source

pub fn section(self, section: impl Into<String>) -> Self

Override the default section this man page is placed in

Common values:

  • "1": User Commands
  • "2": System Calls
  • "3": C Library Functions
  • "4": Devices and Special Files
  • "5": File Formats and Conventions
  • "6": Games et. al.
  • "7": Miscellanea
  • "8": System Administration tools and Daemons
source

pub fn date(self, date: impl Into<String>) -> Self

Override the default date for the last non-trivial change to this man page

Dates should be written in the form YYYY-MM-DD.

source

pub fn source(self, source: impl Into<String>) -> Self

Override the default source your command

For those few man-pages pages in Sections 1 and 8, probably you just want to write GNU.

source

pub fn manual(self, manual: impl Into<String>) -> Self

Override the default manual this page is a member of

source§

impl Man

Generate ROFF output

source

pub fn render(&self, w: &mut dyn Write) -> Result<(), Error>

Render a full manual page into the writer.

If customization is needed, you can call the individual sections you want and mix them into your own ROFF content.

source

pub fn render_title(&self, w: &mut dyn Write) -> Result<(), Error>

Render the title into the writer.

source

pub fn render_name_section(&self, w: &mut dyn Write) -> Result<(), Error>

Render the NAME section into the writer.

source

pub fn render_synopsis_section(&self, w: &mut dyn Write) -> Result<(), Error>

Render the SYNOPSIS section into the writer.

source

pub fn render_description_section(&self, w: &mut dyn Write) -> Result<(), Error>

Render the DESCRIPTION section into the writer.

source

pub fn render_options_section(&self, w: &mut dyn Write) -> Result<(), Error>

Render the OPTIONS section into the writer.

source

pub fn render_subcommands_section(&self, w: &mut dyn Write) -> Result<(), Error>

Render the SUBCOMMANDS section into the writer.

source

pub fn render_extra_section(&self, w: &mut dyn Write) -> Result<(), Error>

Render the EXTRA section into the writer.

source

pub fn render_version_section(&self, w: &mut dyn Write) -> Result<(), Error>

Render the VERSION section into the writer.

source

pub fn render_authors_section(&self, w: &mut dyn Write) -> Result<(), Error>

Render the AUTHORS section into the writer.

Auto Trait Implementations§

§

impl !RefUnwindSafe for Man

§

impl Send for Man

§

impl Sync for Man

§

impl Unpin for Man

§

impl !UnwindSafe for Man

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.