Comparing version 0.1.0 to 0.1.1
35
cli.js
@@ -31,29 +31,28 @@ #!/usr/bin/env node | ||
function fail(err) { | ||
process.stdout.write(error('✖ ') + err.message + '\n'); | ||
process.exit(1); | ||
process.stdout.write(error('✖') + ' ' + err + '\n'); | ||
process.exit(1); | ||
} | ||
function success(res) { | ||
if (res.hasOwnProperty('success')) { | ||
res.success = null; | ||
delete res.success; | ||
} | ||
var heads = Object.keys(res); | ||
var values = heads.map(function getValues(k) { | ||
return res[k]; | ||
}); | ||
var table = new _cliTable2['default']({ | ||
head: heads | ||
}); | ||
table.push(values); | ||
process.stdout.write(table.toString() + '\n'); | ||
process.exit(); | ||
if (res.hasOwnProperty('success')) { | ||
res.success = null; | ||
delete res.success; | ||
} | ||
var head = Object.keys(res); | ||
var values = head.map(function (k) { | ||
return res[k]; | ||
}); | ||
var table = new _cliTable2['default']({ head: head }); | ||
table.push(values); | ||
process.stdout.write(table.toString() + '\n'); | ||
process.exit(); | ||
} | ||
_commander2['default'].version(_packageJson2['default'].version).usage('<zipcode>').description('Search address using zip code').arguments('<zipcode>').action(function (zipcode) { | ||
(0, _ioCep2['default'])(zipcode).then(success)['catch'](fail); | ||
(0, _ioCep2['default'])(zipcode).then(success)['catch'](fail); | ||
}).parse(process.argv); | ||
if (!_commander2['default'].args.length) { | ||
_commander2['default'].help(); | ||
_commander2['default'].help(); | ||
} |
{ | ||
"name": "io-cep-cli", | ||
"version": "0.1.0", | ||
"description": "Search address using zip code through Correios's form", | ||
"version": "0.1.1", | ||
"description": "Search address using zip code through Correios", | ||
"license": "MIT", | ||
@@ -16,6 +16,2 @@ "repository": "lagden/io-cep-cli", | ||
}, | ||
"scripts": { | ||
"pretest": "babel --stage 1 --modules common --no-comments es6 --out-dir ./", | ||
"test": "mocha --compilers js:babel/register --reporter spec --require should" | ||
}, | ||
"bin": { | ||
@@ -36,6 +32,32 @@ "cep": "cli.js" | ||
], | ||
"scripts": { | ||
"pretest": "xo && babel --stage 1 --modules common --no-comments es6 --out-dir ./", | ||
"test": "mocha --compilers js:babel/register --reporter spec --require should", | ||
"prepublish": "npm test", | ||
"start": "watch xo es6 -d -u" | ||
}, | ||
"xo": { | ||
"envs": [ | ||
"es6", | ||
"node" | ||
], | ||
"esnext": true, | ||
"ignores": [ | ||
"cli.js" | ||
], | ||
"rules": { | ||
"arrow-parens": [2, "as-needed"], | ||
"prefer-reflect": [2, {"exceptions": ["delete"]}], | ||
"new-cap": [2, { | ||
"newIsCap": true, | ||
"capIsNew": false | ||
}] | ||
} | ||
}, | ||
"devDependencies": { | ||
"babel": "^5.8.14", | ||
"babel": "^5.8.23", | ||
"mocha": "*", | ||
"should": "*" | ||
"should": "*", | ||
"watch": "^0.16.0", | ||
"xo": "^0.9.0" | ||
}, | ||
@@ -46,4 +68,4 @@ "dependencies": { | ||
"commander": "^2.8.1", | ||
"io-cep": "^0.4.3" | ||
"io-cep": "^0.4.4" | ||
} | ||
} |
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
4423
5
37
34
Updatedio-cep@^0.4.4