MCPcopy Create free account
hub / github.com/ProtonDriveApps/sdk / wrapText

Function wrapText

cli/src/cli/help.ts:175–197  ·  view source on GitHub ↗
(text: string, width: number)

Source from the content-addressed store, hash-verified

173function visibleOptions(command: Command): [string, Option][] {
174 return Object.entries(command.options || {}).filter(([name]) => !HIDDEN_OPTIONS.has(name)) as [
175 string,
176 Option,
177 ][];
178}
179
180/** Last segment of the long option name (e.g. conflict-strategy → STRATEGY). */
181function getOptionVariableName(longName: string): string {
182 const segments = longName.split('-').filter(Boolean);
183 const base = segments.length ? segments[segments.length - 1]! : longName;
184 return base.toUpperCase();
185}
186
187export function wrapText(text: string, width: number): string[] {
188 if (!text) {
189 return [''];
190 }
191
192 const lines: string[] = [];
193 for (const paragraph of text.trim().split('\n')) {
194 const trimmed = paragraph.trim();
195 if (!trimmed) {
196 lines.push('');
197 continue;
198 }
199
200 let line = '';

Callers 2

printCommandUsageFunction · 0.85
printOptionManualRowFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected