MCPcopy Index your code
hub / github.com/Effect-TS/effect / toAnsiDocInternal

Function toAnsiDocInternal

packages/cli/src/internal/helpDoc.ts:140–178  ·  view source on GitHub ↗
(self: HelpDoc.HelpDoc)

Source from the content-addressed store, hash-verified

138// =============================================================================
139
140const toAnsiDocInternal = (self: HelpDoc.HelpDoc): Doc.AnsiDoc => {
141 switch (self._tag) {
142 case "Empty": {
143 return Doc.empty
144 }
145 case "Header": {
146 return pipe(
147 Doc.annotate(InternalSpan.toAnsiDoc(self.value), Ansi.bold),
148 Doc.cat(Doc.hardLine)
149 )
150 }
151 case "Paragraph": {
152 return pipe(
153 InternalSpan.toAnsiDoc(self.value),
154 Doc.cat(Doc.hardLine)
155 )
156 }
157 case "DescriptionList": {
158 const definitions = self.definitions.map(([span, doc]) =>
159 Doc.cats([
160 Doc.annotate(InternalSpan.toAnsiDoc(span), Ansi.bold),
161 Doc.empty,
162 Doc.indent(toAnsiDocInternal(doc), 2)
163 ])
164 )
165 return Doc.vsep(definitions)
166 }
167 case "Enumeration": {
168 const elements = self.elements.map((doc) => Doc.cat(Doc.text("- "), toAnsiDocInternal(doc)))
169 return Doc.indent(Doc.vsep(elements), 2)
170 }
171 case "Sequence": {
172 return Doc.vsep([
173 toAnsiDocInternal(self.left),
174 toAnsiDocInternal(self.right)
175 ])
176 }
177 }
178}

Callers 1

toAnsiDocFunction · 0.85

Calls 4

pipeFunction · 0.70
annotateMethod · 0.65
mapMethod · 0.65
textMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…