Skip to main content Link Search Menu Expand Document (external link)

HelpDoc overview

Added in v1.0.0


Table of contents


combinators

orElse

Signature

export declare const orElse: { (that: HelpDoc): (self: HelpDoc) => HelpDoc; (self: HelpDoc, that: HelpDoc): HelpDoc }

Added in v1.0.0

sequence

Signature

export declare const sequence: { (that: HelpDoc): (self: HelpDoc) => HelpDoc; (self: HelpDoc, that: HelpDoc): HelpDoc }

Added in v1.0.0

constructors

blocks

Signature

export declare const blocks: (helpDocs: Iterable<HelpDoc>) => HelpDoc

Added in v1.0.0

descriptionList

Signature

export declare const descriptionList: (definitions: NonEmptyReadonlyArray<[Span, HelpDoc]>) => HelpDoc

Added in v1.0.0

empty

Signature

export declare const empty: HelpDoc

Added in v1.0.0

enumeration

Signature

export declare const enumeration: (elements: NonEmptyReadonlyArray<HelpDoc>) => HelpDoc

Added in v1.0.0

h1

Signature

export declare const h1: (value: string | Span) => HelpDoc

Added in v1.0.0

h2

Signature

export declare const h2: (value: string | Span) => HelpDoc

Added in v1.0.0

h3

Signature

export declare const h3: (value: string | Span) => HelpDoc

Added in v1.0.0

p

Signature

export declare const p: (value: string | Span) => HelpDoc

Added in v1.0.0

getters

getSpan

Signature

export declare const getSpan: (self: HelpDoc) => Span

Added in v1.0.0

mapping

mapDescriptionList

Signature

export declare const mapDescriptionList: {
  (f: (span: Span, helpDoc: HelpDoc) => [Span, HelpDoc]): (self: HelpDoc) => HelpDoc
  (self: HelpDoc, f: (span: Span, helpDoc: HelpDoc) => [Span, HelpDoc]): HelpDoc
}

Added in v1.0.0

models

DescriptionList (interface)

Signature

export interface DescriptionList {
  readonly _tag: "DescriptionList"
  readonly definitions: NonEmptyReadonlyArray<readonly [Span, HelpDoc]>
}

Added in v1.0.0

Empty (interface)

Signature

export interface Empty {
  readonly _tag: "Empty"
}

Added in v1.0.0

Enumeration (interface)

Signature

export interface Enumeration {
  readonly _tag: "Enumeration"
  readonly elements: NonEmptyReadonlyArray<HelpDoc>
}

Added in v1.0.0

Header (interface)

Signature

export interface Header {
  readonly _tag: "Header"
  readonly value: Span
  readonly level: number
}

Added in v1.0.0

HelpDoc (type alias)

A HelpDoc models the full documentation for a command-line application.

HelpDoc is composed of optional header and footers, and in-between, a list of HelpDoc-level content items.

HelpDoc-level content items, in turn, can be headers, paragraphs, description lists, and enumerations.

A HelpDoc can be converted into plaintext, JSON, and HTML.

Signature

export type HelpDoc = Empty | Header | Paragraph | DescriptionList | Enumeration | Sequence

Added in v1.0.0

Paragraph (interface)

Signature

export interface Paragraph {
  readonly _tag: "Paragraph"
  readonly value: Span
}

Added in v1.0.0

Sequence (interface)

Signature

export interface Sequence {
  readonly _tag: "Sequence"
  readonly left: HelpDoc
  readonly right: HelpDoc
}

Added in v1.0.0

refinements

isDescriptionList

Signature

export declare const isDescriptionList: (helpDoc: HelpDoc) => helpDoc is DescriptionList

Added in v1.0.0

isEmpty

Signature

export declare const isEmpty: (helpDoc: HelpDoc) => helpDoc is Empty

Added in v1.0.0

isEnumeration

Signature

export declare const isEnumeration: (helpDoc: HelpDoc) => helpDoc is Enumeration

Added in v1.0.0

isHeader

Signature

export declare const isHeader: (helpDoc: HelpDoc) => helpDoc is Header

Added in v1.0.0

isParagraph

Signature

export declare const isParagraph: (helpDoc: HelpDoc) => helpDoc is Paragraph

Added in v1.0.0

isSequence

Signature

export declare const isSequence: (helpDoc: HelpDoc) => helpDoc is Sequence

Added in v1.0.0

rendering

toAnsiDoc

Signature

export declare const toAnsiDoc: (self: HelpDoc) => AnsiDoc

Added in v1.0.0

toAnsiText

Signature

export declare const toAnsiText: (self: HelpDoc) => string

Added in v1.0.0