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

simple-bin-help

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-bin-help - npm Package Compare versions

Comparing version 1.6.0 to 1.7.0

40

index.js

@@ -5,2 +5,3 @@ 'use strict'

var wrap = require('word-wrap')
var debug = require('debug')('simple-bin-help')

@@ -15,2 +16,10 @@ function isHelp (arg) {

function isVersion (arg) {
return arg === '-v' || arg === '--version'
}
function hasVersionArgument (args) {
return args.some(isVersion)
}
function noArguments (minLength, args) {

@@ -33,2 +42,3 @@ console.assert(Array.isArray(args), 'missing arguments')

var helpMessage = options.help || options.helpMessage
debug('showHelp options %j', options)

@@ -55,5 +65,6 @@ var pkg = getPackage(options)

if (!pkgInfo && !helpMessage) {
console.log('Incorrect CLI arguments')
console.log('Incorrect CLI arguments (could not find pkg or help)')
if (pkg && pkg.name) {
console.log('Check out instructions for this module using `npm home ' + pkg.name + '`')
console.log('Check out instructions for this module using `npm home ' +
pkg.name + '`')
}

@@ -70,2 +81,6 @@ }

function showVersion (pkg) {
console.log(pkg.name, pkg.version)
}
function simpleBinHelp (options, cliArguments) {

@@ -77,4 +92,6 @@ console.assert(options, 'missing options')

}
debug('options %j cli arguments %j', options, cliArguments)
if (hasHelpArgument(cliArguments)) {
debug('has CLI help argument')
showHelp(options)

@@ -86,2 +103,14 @@ finish(options)

var pkg = getPackage(options)
if (pkg) {
debug('found package %s %s', pkg.name, pkg.version)
} else {
debug('could not get package from options %j', options)
}
if (pkg && hasVersionArgument(cliArguments)) {
showVersion(pkg)
finish(options)
return true
}
if (pkg && pkg.name && pkg.version) {

@@ -109,1 +138,8 @@ updateNotifier({ pkg: pkg }).notify()

module.exports = simpleBinHelp
if (!module.parent) {
simpleBinHelp({
packagePath: './package.json',
help: 'test help message'
})
}

27

package.json

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

"main": "index.js",
"version": "1.6.0",
"version": "1.7.0",
"scripts": {

@@ -13,4 +13,4 @@ "test": "mocha --harmony spec",

"size": "t=\"$(npm pack .)\"; wc -c \"${t}\"; tar tvf \"${t}\"; rm \"${t}\";",
"lint": "standard *.js spec/*.js examples/*.js",
"basic": "node --harmony examples/basic.js"
"lint": "standard --fix *.js spec/*.js examples/*.js",
"basic": "NODE_PATH=.. node --harmony examples/basic.js"
},

@@ -41,13 +41,13 @@ "files": [

"devDependencies": {
"check-more-types": "2.2.0",
"git-issues": "1.2.0",
"lazy-ass": "1.1.0",
"mocha": "2.3.4",
"pre-git": "2.0.2",
"semantic-release": "4.3.5",
"standard": "5.4.1"
"check-more-types": "2.24.0",
"git-issues": "1.3.1",
"lazy-ass": "1.6.0",
"mocha": "3.4.2",
"pre-git": "3.15.0",
"semantic-release": "^6.3.6",
"standard": "10.0.2"
},
"config": {
"pre-git": {
"commit-msg": "validate-commit-msg",
"commit-msg": "simple",
"pre-commit": [

@@ -66,5 +66,6 @@ "npm run lint",

"dependencies": {
"update-notifier": "0.5.0",
"word-wrap": "1.1.0"
"debug": "2.6.8",
"update-notifier": "2.1.0",
"word-wrap": "1.2.3"
}
}

@@ -8,4 +8,2 @@ # simple-bin-help

[![Build status][simple-bin-help-ci-image] ][simple-bin-help-ci-url]
[![dependencies][simple-bin-help-dependencies-image] ][simple-bin-help-dependencies-url]
[![devdependencies][simple-bin-help-devdependencies-image] ][simple-bin-help-devdependencies-url]
[![semantic-release][semantic-image] ][semantic-url]

@@ -67,5 +65,12 @@ [![standard](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)

* Includes and calls the [update-notifier]() module by default.
* Includes and calls the [update-notifier][update-notifier] module by default.
* If passed `-h` or `--help` option, shows the help message.
* If passed `-v` or `--version` option, shows the package version.
[update-notifier]: https://github.com/yeoman/update-notifier#readme
## Debug
Run code with `DEBUG=simple-bin-help ...` environment variable
### Small print

@@ -76,4 +81,4 @@

* [@bahmutov](https://twitter.com/bahmutov)
* [glebbahmutov.com](http://glebbahmutov.com)
* [blog](http://glebbahmutov.com/blog/)
* [glebbahmutov.com](https://glebbahmutov.com)
* [blog](https://glebbahmutov.com/blog/)

@@ -112,11 +117,7 @@ License: MIT - do anything with the code, but don't blame me if it does not work.

[simple-bin-help-icon]: https://nodei.co/npm/simple-bin-help.png?downloads=true
[simple-bin-help-icon]: https://nodei.co/npm/simple-bin-help.svg?downloads=true
[simple-bin-help-url]: https://npmjs.org/package/simple-bin-help
[simple-bin-help-ci-image]: https://travis-ci.org/bahmutov/simple-bin-help.png?branch=master
[simple-bin-help-ci-image]: https://travis-ci.org/bahmutov/simple-bin-help.svg?branch=master
[simple-bin-help-ci-url]: https://travis-ci.org/bahmutov/simple-bin-help
[simple-bin-help-dependencies-image]: https://david-dm.org/bahmutov/simple-bin-help.png
[simple-bin-help-dependencies-url]: https://david-dm.org/bahmutov/simple-bin-help
[simple-bin-help-devdependencies-image]: https://david-dm.org/bahmutov/simple-bin-help/dev-status.png
[simple-bin-help-devdependencies-url]: https://david-dm.org/bahmutov/simple-bin-help#info=devDependencies
[semantic-image]: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg
[semantic-url]: https://github.com/semantic-release/semantic-release
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