Skip to content

Commit

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

default:
yargs.showHelp();

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

// Save objects before exit
Expand Down

0 comments on commit bd5f9ba

Please sign in to comment.