MCPcopy
hub / github.com/tj/commander.js / styleUsage

Method styleUsage

lib/help.js:550–563  ·  view source on GitHub ↗
(str)

Source from the content-addressed store, hash-verified

548 }
549
550 styleUsage(str) {
551 // Usage has lots of parts the user might like to color separately! Assume default usage string which is formed like:
552 // command subcommand [options] [command] <foo> [bar]
553 return str
554 .split(' ')
555 .map((word) => {
556 if (word === '[options]') return this.styleOptionText(word);
557 if (word === '[command]') return this.styleSubcommandText(word);
558 if (word[0] === '[' || word[0] === '<')
559 return this.styleArgumentText(word);
560 return this.styleCommandText(word); // Restrict to initial words?
561 })
562 .join(' ');
563 }
564 styleCommandDescription(str) {
565 return this.styleDescriptionText(str);
566 }

Callers 2

formatHelpMethod · 0.80
index.test-d.tsFile · 0.80

Calls 4

styleOptionTextMethod · 0.95
styleSubcommandTextMethod · 0.95
styleArgumentTextMethod · 0.95
styleCommandTextMethod · 0.95

Tested by

no test coverage detected