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

Method longestOptionTermLength

lib/help.js:225–232  ·  view source on GitHub ↗

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

(cmd, helper)

Source from the content-addressed store, hash-verified

223 */
224
225 longestOptionTermLength(cmd, helper) {
226 return helper.visibleOptions(cmd).reduce((max, option) => {
227 return Math.max(
228 max,
229 this.displayWidth(helper.styleOptionTerm(helper.optionTerm(option))),
230 );
231 }, 0);
232 }
233
234 /**
235 * Get the longest global option term length.

Callers 3

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

Calls 4

displayWidthMethod · 0.95
visibleOptionsMethod · 0.80
styleOptionTermMethod · 0.80
optionTermMethod · 0.80

Tested by

no test coverage detected