Skip to content

hotogwc/Roff-Swift

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RoffSwift

Roff generation library written in Swift. ( Inspired by roff-rs)

Examples

let page = Roff("corrupt", section: 1)
            .appendSection("name", content: ["corrupt - modify files by randomly changing bits"])
            .appendSection("SYNOPSIS", content: [
                Printer.bold(input: "corrupt"),
                " ",
                "[", Printer.bold(input: "-n"), " ", Printer.italic(input: "BITS"), "]",
                " ",
                "[", Printer.bold(input: "--bits"), " ", Printer.italic(input: "BITS"), "]",
                " ",
                Printer.italic(input: "file"), "..."
                ])
            .appendSection("description", content: [Printer.bold(input: "corrupt"), " modifies files by toggling a randomly chosen bit."])
            .appendSection("options", content: [
                Printer.list(header: [Printer.bold(input: "-n"),
                                      ", ",
                                      Printer.bold(input: "--bits"),
                                      "=",
                                      Printer.italic(input: "BITS")],
                             content: ["Set the number of bits to modify. ", "Default is one bit."])
                ])

Which outputs:

.TH CORRUPT 1
.SH NAME
corrupt \- modify files by randomly changing bits
.SH SYNOPSIS
.B corrupt
[\fB\-n\fR \fIBITS\fR]
[\fB\-\-bits\fR \fIBITS\fR]
.IR file ...
.SH DESCRIPTION
.B corrupt
modifies files by toggling a randomly chosen bit.
.SH OPTIONS
.TP
.BR \-n ", " \-\-bits =\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)

About

simple man page generator in Swift

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages