Comparing version 0.0.0 to 0.0.1
@@ -14,2 +14,47 @@ #!/usr/bin/env node | ||
var getopt = require('posix-getopt'); | ||
var latest = require('latest'); | ||
var package = require('../package.json'); | ||
/** | ||
* Usage | ||
* | ||
* return the usage message | ||
*/ | ||
function usage() { | ||
return [ | ||
'Usage: amass', | ||
'', | ||
'Gather system information and expose it as JSON', | ||
'', | ||
'-h, --help print this message and exit', | ||
'-u, --updates check for available updates', | ||
'-v, --version print the version number and exit' | ||
].join('\n'); | ||
} | ||
// command line arguments | ||
var options = [ | ||
'h(help)', | ||
'u(updates)', | ||
'v(version)' | ||
].join(''); | ||
var parser = new getopt.BasicParser(options, process.argv); | ||
var option; | ||
while ((option = parser.getopt()) !== undefined) { | ||
switch (option.option) { | ||
case 'h': console.log(usage()); process.exit(0); | ||
case 'u': // check for updates | ||
latest.checkupdate(package, function(ret, msg) { | ||
console.log(msg); | ||
process.exit(ret); | ||
}); | ||
return; | ||
case 'v': console.log(package.version); process.exit(0); | ||
default: console.error(usage()); process.exit(1); break; | ||
} | ||
} | ||
amass(function(errors, data) { | ||
@@ -19,3 +64,4 @@ if (errors) errors.forEach(function(err) { | ||
}); | ||
data.amass = package.version; | ||
console.log(JSON.stringify(data, null, 2)); | ||
}); |
@@ -5,3 +5,3 @@ { | ||
"author": "Dave Eddy <dave@daveeddy.com> (http://www.daveeddy.com)", | ||
"version": "0.0.0", | ||
"version": "0.0.1", | ||
"bin": { | ||
@@ -21,3 +21,7 @@ "amass": "./bin/amass.js" | ||
], | ||
"license": "MIT" | ||
"license": "MIT", | ||
"dependencies": { | ||
"latest": "~0.1.0", | ||
"posix-getopt": "~1.0.0" | ||
} | ||
} |
@@ -29,4 +29,6 @@ amass | ||
`data` is an object representing all of the data that was amassed, and errors, | ||
if set, is an array of any errors encountered from any of the plugins. | ||
* `data` is an object representing all of the system information that was | ||
amassed. | ||
* `errors`, if set, is an array of any errors encountered from any of | ||
the plugins. | ||
@@ -38,3 +40,3 @@ Command line tool | ||
$ amass | json os.type | ||
x64 | ||
Darwin | ||
$ amass | json os.cpus.0 | ||
@@ -41,0 +43,0 @@ { |
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
4551
111
73
2
+ Addedlatest@~0.1.0
+ Addedposix-getopt@~1.0.0
+ Addedlatest@0.1.2(transitive)
+ Addednpm@1.3.26(transitive)
+ Addedposix-getopt@1.0.0(transitive)