MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / section

Function section

apps/desktop/src/cli/help.ts:206–225  ·  view source on GitHub ↗
(heading: string, rows: CommandRow[], width: number)

Source from the content-addressed store, hash-verified

204}
205
206function section(heading: string, rows: CommandRow[], width: number): string[] {
207 const out: string[] = []
208 out.push(bold(yellow(heading)))
209 const descWidth = width - COMMAND_COLUMN_WIDTH - 2
210 for (const row of rows) {
211 const namePainted = magenta(row.name)
212 const descLines = wrapLines(row.description, descWidth)
213 out.push(' ' + pad(namePainted, COMMAND_COLUMN_WIDTH) + descLines[0])
214 for (const cont of descLines.slice(1)) {
215 out.push(' ' + ' '.repeat(COMMAND_COLUMN_WIDTH) + cont)
216 }
217 if (row.flags) {
218 const flagLines = wrapLines(row.flags, descWidth)
219 for (const line of flagLines) {
220 out.push(' ' + ' '.repeat(COMMAND_COLUMN_WIDTH) + dim(cyan(line)))
221 }
222 }
223 }
224 return out
225}
226
227function paragraph(lines: string[]): string[] {
228 return ['', ...lines, '']

Callers 1

renderHelpFunction · 0.85

Calls 7

boldFunction · 0.85
yellowFunction · 0.85
magentaFunction · 0.85
wrapLinesFunction · 0.85
dimFunction · 0.85
cyanFunction · 0.85
padFunction · 0.70

Tested by

no test coverage detected