command-line-usage
Advanced tools
Comparing version 2.0.2 to 2.0.3
'use strict'; | ||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
var columnLayout = require('column-layout'); | ||
@@ -21,9 +17,7 @@ var o = require('object-tools'); | ||
var Lines = (function (_Array) { | ||
_inherits(Lines, _Array); | ||
var Lines = function () { | ||
function Lines() { | ||
_classCallCheck(this, Lines); | ||
_get(Object.getPrototypeOf(Lines.prototype), 'constructor', this).apply(this, arguments); | ||
this.list = []; | ||
} | ||
@@ -37,3 +31,3 @@ | ||
arrayify(content).forEach(function (line) { | ||
return _this.push(ansi.format(line)); | ||
return _this.list.push(ansi.format(line)); | ||
}); | ||
@@ -44,3 +38,3 @@ } | ||
value: function emptyLine() { | ||
this.push(''); | ||
this.list.push(''); | ||
} | ||
@@ -50,3 +44,3 @@ }]); | ||
return Lines; | ||
})(Array); | ||
}(); | ||
@@ -110,3 +104,3 @@ function getUsage(definitions, options) { | ||
return output.join(os.EOL); | ||
return output.list.join(os.EOL); | ||
} | ||
@@ -135,3 +129,3 @@ | ||
if (!content) { | ||
return lines; | ||
return lines.list; | ||
} else { | ||
@@ -162,3 +156,3 @@ if (t.isString(content)) { | ||
lines.emptyLine(); | ||
return lines; | ||
return lines.list; | ||
} | ||
@@ -199,3 +193,3 @@ } | ||
option: getOptionNames(def, 'bold'), | ||
description: def.description | ||
description: ansi.format(def.description) | ||
}); | ||
@@ -202,0 +196,0 @@ }); |
'use strict'; | ||
var arrayify = require('array-back'); | ||
@@ -3,0 +4,0 @@ |
@@ -15,9 +15,12 @@ 'use strict' | ||
class Lines extends Array { | ||
class Lines { | ||
constructor () { | ||
this.list = [] | ||
} | ||
add (content) { | ||
arrayify(content).forEach(line => this.push(ansi.format(line))) | ||
arrayify(content).forEach(line => this.list.push(ansi.format(line))) | ||
} | ||
emptyLine () { | ||
this.push('') | ||
this.list.push('') | ||
} | ||
@@ -92,3 +95,3 @@ } | ||
return output.join(os.EOL) | ||
return output.list.join(os.EOL) | ||
} | ||
@@ -117,3 +120,3 @@ | ||
if (!content) { | ||
return lines | ||
return lines.list | ||
} else { | ||
@@ -145,3 +148,3 @@ if (t.isString(content)) { | ||
lines.emptyLine() | ||
return lines | ||
return lines.list | ||
} | ||
@@ -148,0 +151,0 @@ } |
{ | ||
"name": "command-line-usage", | ||
"author": "Lloyd Brookes <75pound@gmail.com>", | ||
"version": "2.0.2", | ||
"version": "2.0.3", | ||
"description": "Generates command-line usage information", | ||
@@ -21,3 +21,3 @@ "repository": "https://github.com/75lb/command-line-usage.git", | ||
"test": "tape test/*.js", | ||
"es5": "babel --no-comments lib --out-dir es5" | ||
"es5": "babel --presets babel-preset-es2015 --no-comments lib --out-dir es5" | ||
}, | ||
@@ -27,10 +27,11 @@ "dependencies": { | ||
"array-back": "^1.0.2", | ||
"column-layout": "^2", | ||
"feature-detect-es6": "^1.0.0", | ||
"column-layout": "^2.1", | ||
"feature-detect-es6": "^1.2.0", | ||
"object-tools": "^2", | ||
"typical": "^2.3.1" | ||
"typical": "^2.4.2" | ||
}, | ||
"devDependencies": { | ||
"jsdoc-to-markdown": "^1.1.1", | ||
"tape": "^4.0.0" | ||
"babel-preset-es2015": "^6.5.0", | ||
"jsdoc-to-markdown": "^1.3.3", | ||
"tape": "^4.4.0" | ||
}, | ||
@@ -37,0 +38,0 @@ "standard": { |
@@ -238,2 +238,2 @@ [![view on npm](http://img.shields.io/npm/v/command-line-usage.svg)](https://www.npmjs.org/package/command-line-usage) | ||
© 2015 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/75lb/jsdoc-to-markdown). | ||
© 2015-16 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/75lb/jsdoc-to-markdown). |
@@ -27,2 +27,4 @@ var test = require('tape') | ||
t.ok(/a typical app/.test(result)) | ||
t.ok(/Generates something very important/.test(result)) | ||
t.ok(/Display this usage guide/.test(result)) | ||
t.end() | ||
@@ -29,0 +31,0 @@ }) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
439783
3
800
Updatedcolumn-layout@^2.1
Updatedfeature-detect-es6@^1.2.0
Updatedtypical@^2.4.2