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

Method longestSubcommandTermLength

lib/help.js:206–215  ·  view source on GitHub ↗

* Get the longest command term length. * * @param {Command} cmd * @param {Help} helper * @returns {number}

(cmd, helper)

Source from the content-addressed store, hash-verified

204 */
205
206 longestSubcommandTermLength(cmd, helper) {
207 return helper.visibleCommands(cmd).reduce((max, command) => {
208 return Math.max(
209 max,
210 this.displayWidth(
211 helper.styleSubcommandTerm(helper.subcommandTerm(command)),
212 ),
213 );
214 }, 0);
215 }
216
217 /**
218 * Get the longest option term length.

Callers 3

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

Calls 4

displayWidthMethod · 0.95
visibleCommandsMethod · 0.80
styleSubcommandTermMethod · 0.80
subcommandTermMethod · 0.80

Tested by

no test coverage detected