command-line-tool
Advanced tools
Comparing version 0.2.0 to 0.2.1
@@ -5,2 +5,3 @@ 'use strict' | ||
var t = require('typical') | ||
var where = require('test-value').cb | ||
@@ -36,3 +37,3 @@ /** | ||
if (options.usage) console.error(options.usage) | ||
if (options.displayUsage) console.error(exports.usage) | ||
process.exit(0) | ||
@@ -82,6 +83,19 @@ } | ||
function options (definitions, usageOptions) { | ||
definitions = arrayify(definitions) | ||
if (!definitions.some(where({ name: 'help '}))) { | ||
definitions.push({ | ||
name: 'help', | ||
alias: 'h', | ||
type: Boolean, | ||
description: 'Print usage information' | ||
}) | ||
} | ||
var commandLineArgs = require('command-line-args') | ||
var cli = commandLineArgs(definitions) | ||
exports.usage = cli.getUsage(usageOptions) | ||
return cli.parse() | ||
var opts = cli.parse() | ||
if (opts.help) { | ||
stop(null, { displayUsage: true }) | ||
} | ||
return opts | ||
} |
{ | ||
"name": "command-line-tool", | ||
"author": "Lloyd Brookes <75pound@gmail.com>", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "command-line-tool", | ||
@@ -21,2 +21,3 @@ "repository": "https://github.com/75lb/command-line-tool.git", | ||
"command-line-args": "^2.1.6", | ||
"test-value": "^1.1.0", | ||
"typical": "^2.4.2" | ||
@@ -23,0 +24,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7088
92
5
+ Addedtest-value@^1.1.0