Crates.io | roff |
lib.rs | roff |
version | 0.2.2 |
source | src |
created_at | 2018-05-28 12:53:14.476526 |
updated_at | 2024-07-25 14:39:27.729414 |
description | ROFF (man page format) generation library |
homepage | https://github.com/rust-cli/roff-rs |
repository | https://github.com/rust-cli/roff-rs |
max_upload_size | |
id | 67448 |
size | 37,284 |
Roff generation library.
use roff::{bold, italic, roman, Roff};
fn main() {
let page = Roff::new()
.control("TH", ["CORRUPT", "1"])
.control("SH", ["NAME"])
.text([roman("corrupt - modify files by randomly changing bits")])
.control("SH", ["SYNOPSIS"])
.text([bold("corrupt"), roman(" ["), bold("-n"), roman(" "), italic("BITS"), roman("] ["),
bold("--bits"), roman(" "), italic("BITS"), roman("] "), italic("FILE"), roman("..."),
])
.control("SH", ["DESCRIPTION"])
.text([bold("corrupt"), roman(" modifies files by toggling a randomly chosen bit.")])
.control("SH", ["OPTIONS"])
.control("TP", [])
.text([bold("-n"), roman(", "), bold("--bits"), roman("="), italic("BITS")])
.text([roman("Set the number of bits to modify. Default is one bit.")]);
.render();
print!("{}", page);
Which outputs:
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.TH CORRUPT 1
.SH NAME
corrupt \- modify files by randomly changing bits
.SH SYNOPSIS
\fBcorrupt\fR [\fB\-n\fR \fIBITS\fR] [\fB\-\-bits\fR \fIBITS\fR] \fIFILE\fR...
.SH DESCRIPTION
\fBcorrupt\fR modifies files by toggling a randomly chosen bit.
.SH OPTIONS
.TP
\fB\-n\fR, \fB\-\-bits\fR=\fIBITS\fR
Set the number of bits to modify. Default is one bit.
Which will be shown by the man(1)
command as:
CORRUPT(1) General Commands Manual CORRUPT(1)
NAME
corrupt - modify files by randomly changing bits
SYNOPSIS
corrupt [-n BITS] [--bits BITS] FILE...
DESCRIPTION
corrupt modifies files by toggling a randomly chosen bit.
OPTIONS
-n, --bits=BITS
Set the number of bits to modify. Default is one bit.
CORRUPT(1)
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.