Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default maxCol to the console width - 1 #18

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/dashdash.js
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,8 @@ Parser.prototype.parse = function parse(inputs) {
* - nameSort {String} Default is 'length'. By default the names are
* sorted to put the short opts first (i.e. '-h, --help' preferred
* to '--help, -h'). Set to 'none' to not do this sorting.
* - maxCol {Number} Default 80. Note that long tokens in a help string
* - maxCol {Number} Default is the console width - 1, or 80 if that
* cannot be determined. Note that long tokens in a help string
* can go past this.
* - helpCol {Number} Set to specify a specific column at which
* option help will be aligned. By default this is determined
Expand Down Expand Up @@ -591,7 +592,7 @@ Parser.prototype.help = function help(config) {
assert.optionalBool(config.includeEnv, 'config.includeEnv');
assert.optionalBool(config.includeDefault, 'config.includeDefault');
assert.optionalBool(config.helpWrap, 'config.helpWrap');
var maxCol = config.maxCol || 80;
var maxCol = config.maxCol || ( process.stdout.columns ? process.stdout.columns - 1 : 80 );
var minHelpCol = config.minHelpCol || 20;
var maxHelpCol = config.maxHelpCol || 40;

Expand Down