Skip to content
Effect 4.0 is here. One ecosystem. Zero dependencies.

HelpDoc

27 exports Since v1.0.0 Source

Combinators

Since v1.0.0

Signature

declare const orElse: {
(that: HelpDoc): (self: HelpDoc) => HelpDoc;
(self: HelpDoc, that: HelpDoc): HelpDoc;
}
Since v1.0.0

Signature

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

Constructors

Since v1.0.0

Signature

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

Signature

declare const descriptionList: (definitions: NonEmptyReadonlyArray<[Span, HelpDoc]>) => HelpDoc
Since v1.0.0

Signature

declare const empty: HelpDoc

Signature

declare const enumeration: (elements: NonEmptyReadonlyArray<HelpDoc>) => HelpDoc
Since v1.0.0

Signature

declare const h1: (value: string | Span) => HelpDoc
Since v1.0.0

Signature

declare const h2: (value: string | Span) => HelpDoc
Since v1.0.0

Signature

declare const h3: (value: string | Span) => HelpDoc
Since v1.0.0

Signature

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

Getters

Since v1.0.0

Signature

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

Mapping

Signature

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

Models

Since v1.0.0

Signature

interface DescriptionList {
readonly _tag: "DescriptionList";
readonly definitions: readonly [readonly [Span, HelpDoc], readonly [Span, HelpDoc]];
}

Empty

interface
Since v1.0.0

Signature

interface Empty {
readonly _tag: "Empty";
}

Enumeration

interface
Since v1.0.0

Signature

interface Enumeration {
readonly _tag: "Enumeration";
readonly elements: readonly [HelpDoc, HelpDoc];
}
Since v1.0.0

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

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

Paragraph

interface
Since v1.0.0

Signature

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

Sequence

interface
Since v1.0.0

Signature

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

Refinements

Signature

declare const isDescriptionList: (helpDoc: HelpDoc) => helpDoc is DescriptionList
Since v1.0.0

Signature

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

Signature

declare const isEnumeration: (helpDoc: HelpDoc) => helpDoc is Enumeration
Since v1.0.0

Signature

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

Signature

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

Signature

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

Rendering

Signature

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

Signature

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