Socket
Socket
Sign inDemoInstall

commander

Package Overview
Dependencies
0
Maintainers
4
Versions
115
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.2.0 to 2.3.0

48

index.js

@@ -8,4 +8,2 @@

var spawn = require('child_process').spawn;
var fs = require('fs');
var exists = fs.existsSync;
var path = require('path');

@@ -148,3 +146,3 @@ var dirname = path.dirname;

Command.prototype.command = function(name, desc){
Command.prototype.command = function(name, desc) {
var args = name.split(/ +/);

@@ -218,5 +216,7 @@ var cmd = new Command(args.shift());

var self = this;
this.parent.on(this._name, function(args, unknown){
var listener = function(args, unknown){
// Parse any so-far unknown options
args = args || [];
unknown = unknown || [];
var parsed = self.parseOptions(unknown);

@@ -253,3 +253,5 @@

fn.apply(this, args);
});
};
this.parent.on(this._name, listener);
if (this._alias) this.parent.on(this._alias, listener);
return this;

@@ -279,3 +281,3 @@ };

*
* // simple boolean defaulting to false
* // simple boolean defaulting to true
* program.option('-C, --no-cheese', 'remove cheese');

@@ -288,3 +290,3 @@ *

* program.cheese
* // => true
* // => false
*

@@ -683,2 +685,16 @@ * // required argument

/**
* Set an alias for the command
*
* @param {String} alias
* @return {String|Command}
* @api public
*/
Command.prototype.alias = function(alias){
if (0 == arguments.length) return this._alias;
this._alias = alias;
return this;
};
/**
* Set / get the command usage `str`.

@@ -761,9 +777,13 @@ *

return pad(cmd._name
return cmd._name
+ (cmd._alias
? '|' + cmd._alias
: '')
+ (cmd.options.length
? ' [options]'
: '') + ' ' + args, 22)
: '') + ' ' + args
+ (cmd.description()
? ' ' + cmd.description()
: '');
? '\n ' + cmd.description()
: '')
+ '\n';
}).join('\n').replace(/^/gm, ' ')

@@ -784,3 +804,7 @@ , ''

''
, ' Usage: ' + this._name + ' ' + this.usage()
, ' Usage: ' + this._name
+ (this._alias
? '|' + this._alias
: '')
+ ' ' + this.usage()
, '' + this.commandHelp()

@@ -787,0 +811,0 @@ , ' Options:'

{
"name": "commander"
, "version": "2.2.0"
, "version": "2.3.0"
, "description": "the complete solution for node.js command-line programs"

@@ -5,0 +5,0 @@ , "keywords": ["command", "option", "parser", "prompt", "stdin"]

@@ -5,3 +5,3 @@ # Commander.js

[![Build Status](https://secure.travis-ci.org/visionmedia/commander.js.png)](http://travis-ci.org/visionmedia/commander.js)
[![Build Status](https://api.travis-ci.org/visionmedia/commander.js.svg)](http://travis-ci.org/visionmedia/commander.js)

@@ -90,3 +90,3 @@ ## Installation

.option('-o, --optional [value]', 'An optional value')
.option('-c, --collect [value]', 'A repeatable value', [])
.option('-c, --collect [value]', 'A repeatable value', collect, [])
.option('-v, --verbose', 'A value that can be increased', increaseVerbosity, 0)

@@ -93,0 +93,0 @@ .parse(process.argv);

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc