Skip to content

Commit

Permalink
(bluefox) add command "iobroker version"
Browse files Browse the repository at this point in the history
  • Loading branch information
GermanBluefox committed Aug 14, 2016
1 parent bd5f9ba commit d202caa
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion lib/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ var yargs = require('yargs')
tools.appName + ' backup\n' +
tools.appName + ' restore <backup name or path>' +
tools.appName + ' <command> --timeout 5000' +
tools.appName + ' --version' +
tools.appName + ' version [adapter]' +
tools.appName + ' [adapter] -v')
.default('objects', '127.0.0.1')
.default('states', '127.0.0.1')
Expand Down Expand Up @@ -2201,6 +2201,23 @@ switch (yargs.argv._[0]) {
})();
break;

case 'v':
case 'version':
(function () {
var adapter = yargs.argv._[1];
if (adapter) {
try {
iopckg = require('iobroker.' + adapter + '/package.json');
} catch (err) {
iopckg = {version: '"' + adapter + '" not found'};
}
} else {
iopckg = require(__dirname + '/../package.json');
}
console.log(iopckg.version);
})();
break;

default:
if (yargs.argv.v || yargs.argv.version) {
var iopckg;
Expand Down

0 comments on commit d202caa

Please sign in to comment.