Display options before positional arguments in help and usage

This commit is contained in:
astefanutti 2015-07-21 16:34:55 +02:00
parent 1c9608d00d
commit c63aa7f192

View File

@ -348,6 +348,16 @@ ArgParser.prototype = {
return opt.position === undefined;
});
if (options.length) {
if (!this._nocolors) {
// must be a better way to do this
str += chalk.blue(" [options]");
}
else {
str += " [options]";
}
}
// assume there are no gaps in the specified pos. args
positionals.forEach(function(pos) {
if (!pos.hidden) {
@ -368,16 +378,6 @@ ArgParser.prototype = {
}
});
if (options.length) {
if (!this._nocolors) {
// must be a better way to do this
str += chalk.blue(" [options]");
}
else {
str += " [options]";
}
}
if (options.length || positionals.length) {
str += "\n\n";
}