/// Outputs the manual page to the given path.
///
/// If the path is `None`, outputs to stdout.
Outputs the manual page to the given path.
If the path is `None`, outputs to stdout.
Outputs the manual page to the given path . If the path is ` None ` outputs to stdout .
fn output_man(output: Option<PathBuf>) -> Result<(), Error> {
        match output {
            Some(path) => {
                let mut file = match fs::File::create(&path) {
                    Ok(file) => file,
                    Err(err) => {
                        eprintln!(
                            "Failed to open output file {}: {}",
                            path.display(), err
                        );
                        return Err(Error)
                    }
                };
                if let Err(err) = file.write_all(MAN_PAGE) {
                    eprintln!("Failed to write to output file: {}", err);
                    return Err(Error)
                }
                info!(
                    "Successfully writen manual page to {}",
                    path.display()
                );
            }
            None => {
                let out = io::stdout();
                let mut out = out.lock();
                if let Err(err) = out.write_all(MAN_PAGE) {
                    eprintln!("Failed to write man page: {}", err);
                    return Err(Error)
                }
            }
        }
        Ok(())
    }
fn output_man ( output : Option < PathBuf > ) -> Result < ( ) , Error > { match output { Some ( path ) => { let mut file = match fs :: File :: create ( & path ) { Ok ( file ) => file , Err ( err ) => { eprintln ! ( " " path display ( ) err ) ; return Err ( Error ) } } ; if let Err ( err ) = file . write_all ( MAN_PAGE ) { eprintln ! ( " " err ) ; return Err ( Error ) } info ! ( " " path display ( ) ) ; } None => { let out = io :: stdout ( ) ; let mut out = out . lock ( ) ; if let Err ( err ) = out . write_all ( MAN_PAGE ) { eprintln ! ( " " err ) ; return Err ( Error ) } } } Ok ( ( ) ) }
Outputs the manual page to the given path.
Outputs the manual page to the given path .
output
Option<PathBuf>