cli.js
688 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env node
'use strict';
var argv = require('minimist')(process.argv.slice(2));
var pkg = require('./package.json');
var osxRelease = require('./');
var input = argv._[0];
function help() {
console.log([
'',
' ' + pkg.description,
'',
' Usage',
' osx-release [release]',
'',
' Example',
' osx-release',
' Mavericks 10.9',
'',
' osx-release 14.0.0',
' Yosemite 10.10'
].join('\n'));
}
if (!input || argv.help) {
help();
return;
}
if (argv.version) {
console.log(pkg.version);
return;
}
var output = osxRelease(input);
if (!output.name || !output.version) {
process.exit(1);
}
console.log(output.name + ' ' + output.version);