bundle-name
Advanced tools
Comparing version 0.1.1 to 1.0.0
30
cli.js
#!/usr/bin/env node | ||
'use strict'; | ||
var bundleName = require('./index'); | ||
var input = process.argv[2]; | ||
var pkg = require('./package.json'); | ||
var bundleName = require('./'); | ||
var argv = process.argv.slice(2); | ||
var input = argv[0]; | ||
if (!input || process.argv.indexOf('-h') !== -1 || process.argv.indexOf('--help') !== -1) { | ||
return console.log('Usage\n bundle-name <bundle id>\n\nExample\n bundle-name com.apple.Safari\n #=> Safari\n\nReturns the bundle name from a bundle identifier'); | ||
function help() { | ||
console.log([ | ||
'', | ||
' ' + pkg.description, | ||
'', | ||
' Usage', | ||
' bundle-name <bundle-id>', | ||
'', | ||
' Example', | ||
' bundle-name com.apple.Safari', | ||
' Safari' | ||
].join('\n')); | ||
} | ||
if (process.argv.indexOf('-v') !== -1 || process.argv.indexOf('--version') !== -1) { | ||
return console.log(require('./package').version); | ||
if (argv.indexOf('--help') !== -1) { | ||
help(); | ||
return; | ||
} | ||
if (argv.indexOf('--version') !== -1) { | ||
console.log(pkg.version); | ||
return; | ||
} | ||
bundleName(input, function (err, name) { | ||
@@ -15,0 +33,0 @@ if (err) { |
{ | ||
"name": "bundle-name", | ||
"version": "0.1.1", | ||
"version": "1.0.0", | ||
"description": "Get bundle name from a bundle identifier (OS X): com.apple.Safari => Safari", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -8,8 +8,8 @@ # bundle-name [![Build Status](https://travis-ci.org/sindresorhus/bundle-name.png?branch=master)](http://travis-ci.org/sindresorhus/bundle-name) | ||
```sh | ||
$ npm install --save bundle-name | ||
``` | ||
npm install --save bundle-name | ||
``` | ||
## Example | ||
## Usage | ||
@@ -19,4 +19,6 @@ ```js | ||
bundleName('com.apple.Safari'); | ||
//=> Safari | ||
bundleName('com.apple.Safari', function (err, name) { | ||
console.log(name); | ||
//=> Safari | ||
}); | ||
``` | ||
@@ -27,19 +29,25 @@ | ||
You can also use it as a CLI app by installing it globally: | ||
```sh | ||
$ npm install --global bundle-name | ||
``` | ||
npm install --global bundle-name | ||
``` | ||
### Usage | ||
```sh | ||
$ bundle-name --help | ||
Usage | ||
bundle-name <bundle-id> | ||
Example | ||
bundle-name com.apple.Safari | ||
Safari | ||
``` | ||
bundle-name com.apple.Safari | ||
``` | ||
Which will output `Safari`. | ||
## Related | ||
See [bundle-id](https://github.com/sindresorhus/bundle-id) for the inverse. | ||
## License | ||
MIT © [Sindre Sorhus](http://sindresorhus.com) |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
3024
44
1
51