diff options
author | Evgeny Zinoviev <me@ch1p.io> | 2021-03-02 01:53:46 +0300 |
---|---|---|
committer | Evgeny Zinoviev <me@ch1p.io> | 2021-03-02 01:53:46 +0300 |
commit | 7f6454c12f12372e0f8332a4d4f02194fc7f48f5 (patch) | |
tree | 7956368aa6f72f7b09fc4b7608d10a88034cf61c | |
parent | 078f5b8043f0da924676f1ba96937139d7539e3e (diff) |
jobd/jobd-master: add --version option
-rwxr-xr-x | src/jobd-master.js | 9 | ||||
-rwxr-xr-x | src/jobd.js | 9 |
2 files changed, 16 insertions, 2 deletions
diff --git a/src/jobd-master.js b/src/jobd-master.js index d6bc09a..602af9a 100755 --- a/src/jobd-master.js +++ b/src/jobd-master.js @@ -4,6 +4,7 @@ const loggerModule = require('./lib/logger') const config = require('./lib/config') const {Server, ResponseMessage, RequestMessage} = require('./lib/server') const WorkersList = require('./lib/workers-list') +const package_json = require('../package.json') /** * @type {Logger} @@ -43,6 +44,11 @@ async function main() { process.exit(0) } + if (argv.version) { + console.log(package_json.version) + process.exit(0) + } + if (!argv.config) throw new Error('--config option is required') @@ -150,7 +156,8 @@ function usage() { Options: --config <path> - --help` + --help + --version` console.log(s) } diff --git a/src/jobd.js b/src/jobd.js index 0df4e70..6f3c85e 100755 --- a/src/jobd.js +++ b/src/jobd.js @@ -5,6 +5,7 @@ const config = require('./lib/config') const db = require('./lib/db') const {Server, Connection, RequestMessage, ResponseMessage} = require('./lib/server') const {Worker, STATUS_MANUAL} = require('./lib/worker') +const package_json = require('../package.json') /** * @type {Worker} @@ -49,6 +50,11 @@ async function main() { process.exit(0) } + if (argv.version) { + console.log(package_json.version) + process.exit(0) + } + if (!argv.config) throw new Error('--config option is required') @@ -250,7 +256,8 @@ function usage() { Options: --config <path> - --help` + --help + --version` console.log(s) } |