Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bagofholding

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bagofholding - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

6

CHANGELOG.md

@@ -1,2 +0,6 @@

### 0.0.5 (SNAPSHOT)
### 0.0.6 (SNAPSHOT)
* Fix cli#parse option argument handling
* Add cli#parse option action callback
### 0.0.5
* Add mock request

@@ -3,0 +7,0 @@

4

lib/cli.js

@@ -109,3 +109,3 @@ var _ = require('underscore'),

_.each(command.options, function (option) {
program.option(option.short, option.long, option.desc);
program.option(option.arg, option.desc, option.action);
});

@@ -157,2 +157,2 @@

exports.parse = parse;
exports.readConfigFileSync = readConfigFileSync;
exports.readConfigFileSync = readConfigFileSync;

@@ -75,7 +75,7 @@ var obj = require('./obj');

function option(short, long, desc) {
function option(arg, desc, action) {
checks.commander_options.push({
short: short,
long: long,
desc: desc
arg: arg,
desc: desc,
action: action
});

@@ -82,0 +82,0 @@ }

@@ -5,3 +5,3 @@ {

"keywords": [],
"version": "0.0.5",
"version": "0.0.6",
"homepage": "http://github.com/cliffano/bagofholding",

@@ -8,0 +8,0 @@ "author": "Cliffano Subagio <blah@cliffano.com> (http://blog.cliffano.com)",

Bag Of Holding [![http://travis-ci.org/cliffano/bagofholding](https://secure.travis-ci.org/cliffano/bagofholding.png?branch=master)](http://travis-ci.org/cliffano/bagofholding)
-----------
--------------
Bag Of Holding is an uncursed bag of various Node.js utility functions.
An uncursed bag of various Node.js utility functions.
This is an extract of the reusable parts from various Node.js modules I've written. It contains convenient utilities for command-line tools, unit test mock functions, and data manipulation.
Mostly for internal use.
Installation

@@ -9,0 +11,0 @@ ------------

@@ -164,4 +164,4 @@ var bag = require('../lib/bagofholding'),

options: [
{ short: '-a', long: '--aaa', desc: 'option a' },
{ short: '-b', long: '--bbb', desc: 'option b' }
{ arg: '-a, --aaa <foo>', desc: 'option a', action: function () {} },
{ arg: '-b, --bbb <bar>', desc: 'option b' }
],

@@ -173,3 +173,3 @@ action: function () {}

options: [
{ short: '-c', long: '--ccc', desc: 'option c' }
{ arg: '-c, --ccc <xyz>', desc: 'option c' }
],

@@ -186,11 +186,11 @@ action: function () {}

checks.commander_options.length.should.equal(3);
checks.commander_options[0].short.should.equal('-a');
checks.commander_options[0].long.should.equal('--aaa');
checks.commander_options[0].arg.should.equal('-a, --aaa <foo>');
checks.commander_options[0].desc.should.equal('option a');
checks.commander_options[1].short.should.equal('-b');
checks.commander_options[1].long.should.equal('--bbb');
checks.commander_options[0].action.should.be.a('function');
checks.commander_options[1].arg.should.equal('-b, --bbb <bar>');
checks.commander_options[1].desc.should.equal('option b');
checks.commander_options[2].short.should.equal('-c');
checks.commander_options[2].long.should.equal('--ccc');
should.not.exist(checks.commander_options[1].action);
checks.commander_options[2].arg.should.equal('-c, --ccc <xyz>');
checks.commander_options[2].desc.should.equal('option c');
should.not.exist(checks.commander_options[2].action);
checks.fs_readFileSync_file.should.equal('/app/foo/package.json');

@@ -197,0 +197,0 @@ checks.commander_version.should.equal('1.2.3');

@@ -69,11 +69,11 @@ var bag = require('../lib/bagofholding'),

var commander = mock.commander(checks, mocks);
commander.option('-a', '--aa', 'aaa');
commander.option('-b', '--bb', 'bbb');
commander.option('-a, --aa <foo>', 'aaa', function () {});
commander.option('-b, --bb <bar>', 'bbb', function () {});
checks.commander_options.length.should.equal(2);
checks.commander_options[0].short.should.equal('-a');
checks.commander_options[0].long.should.equal('--aa');
checks.commander_options[0].arg.should.equal('-a, --aa <foo>');
checks.commander_options[0].desc.should.equal('aaa');
checks.commander_options[1].short.should.equal('-b');
checks.commander_options[1].long.should.equal('--bb');
checks.commander_options[0].action.should.be.a('function');
checks.commander_options[1].arg.should.equal('-b, --bb <bar>');
checks.commander_options[1].desc.should.equal('bbb');
checks.commander_options[1].action.should.be.a('function');
});

@@ -80,0 +80,0 @@

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc