Skip to content
Myr

Print default value in option help

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Jefts, Richard · committed by Roman Vanesyan · parent b92a7c6 · Browse files · 1 file+7 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+7 added−3 removed

  • other:+7 added−3 removed

1 file+7 added−3 removed

modified:index.js+7 added-3 removed
382 unmodified lines
383 if (false == option.bool || option.optional || option.required) {384 // when --no-* we make sure default is true385 if (false == option.bool) defaultValue = true;386 // preassign only if we have a default387 if (undefined !== defaultValue) self[name] = defaultValue;387 if (undefined !== defaultValue) {388 self[name] = defaultValue;389 option.defaultValue = defaultValue;390 }391 }392393 // register the option394 this.options.push(option);
555 unmodified lines
950 var width = this.largestOptionLength();951952 // Append the help information953 return this.options.map(function(option) {951 return pad(option.flags, width) + ' ' + option.description;952 }).concat([pad('-h, --help', width) + ' ' + 'output usage information'])954 return pad(option.flags, width) + ' ' + option.description955 + (option.defaultValue !== undefined ? ' (default: ' + option.defaultValue + ')' : '');956 }).concat([pad('-h, --help', width) + ' ' + 'output usage information'])957 .join('\n');958};959960/**
186 unmodified lines