MCPcopy Index your code
hub / github.com/callstack/agent-device / renderAlignedSection

Function renderAlignedSection

src/cli/parser/cli-help.ts:1020–1033  ·  view source on GitHub ↗
(
  title: string,
  items: ReadonlyArray<{ label: string; description: string }>,
)

Source from the content-addressed store, hash-verified

1018}
1019
1020function renderAlignedSection(
1021 title: string,
1022 items: ReadonlyArray<{ label: string; description: string }>,
1023): string {
1024 if (items.length === 0) {
1025 return `${title}\n (none)`;
1026 }
1027 const maxLabelLength = Math.max(...items.map((item) => item.label.length)) + 2;
1028 const lines = [title];
1029 for (const item of items) {
1030 lines.push(` ${item.label.padEnd(maxLabelLength)}${item.description}`);
1031 }
1032 return lines.join('\n');
1033}
1034
1035function renderTextSection(title: string, lines: ReadonlyArray<string>): string {
1036 if (lines.length === 0) {

Callers 3

renderUsageTextFunction · 0.85
renderFlagSectionFunction · 0.85
renderCommandSectionFunction · 0.85

Calls 1

pushMethod · 0.80

Tested by

no test coverage detected