diff --git a/dist/index.js b/dist/index.js index 831a2c6..1479022 100644 --- a/dist/index.js +++ b/dist/index.js @@ -21,14 +21,18 @@ var npmci_publish_2 = require("./npmci.publish"); exports.publish = npmci_publish_2.publish; var command; var commandOption; -plugins.commander - .version(npmciInfo.version) +var commander = plugins.commander + .option("-v", "--version", "print version") .arguments(' [commandoptionarg]') .action(function (commandarg, commandoptionarg) { command = commandarg; commandOption = commandoptionarg; }); plugins.commander.parse(process.argv); +if (commander.version) { + console.log(npmciInfo.version); + process.exit(0); +} if (typeof command === 'undefined') { console.error('no command given!'); process.exit(1); @@ -70,4 +74,4 @@ switch (command) { break; } -//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQ0EsUUFBTyxnQkFBZ0IsQ0FBQyxDQUFBO0FBQ3hCLElBQVksT0FBTyxXQUFNLGlCQUFpQixDQUFDLENBQUE7QUFDM0MsSUFBWSxLQUFLLFdBQU0sZUFBZSxDQUFDLENBQUE7QUFDdkMsSUFBSSxTQUFTLEdBQUcsSUFBSSxPQUFPLENBQUMsV0FBVyxDQUFDLGNBQWMsQ0FBQyxLQUFLLENBQUMsZ0JBQWdCLENBQUMsQ0FBQztBQUMvRSxPQUFPLENBQUMsU0FBUyxDQUFDLEdBQUcsQ0FBQyxpQkFBaUIsR0FBRyxTQUFTLENBQUMsT0FBTyxDQUFDLENBQUM7QUFFN0QsNEJBQW9CLGVBQ3BCLENBQUMsQ0FEa0M7QUFDbkMsOEJBQWtDLGlCQUFpQixDQUFDLENBQUE7QUFDcEQsOEJBQXNCLGlCQUFpQixDQUFDLENBQUE7QUFDeEMsOEJBQXNCLGlCQUFpQixDQUFDLENBQUE7QUFDeEMsOEJBQXNCLGlCQUFpQixDQUFDLENBQUE7QUFFeEMsMkJBQW1CLGNBQWMsQ0FBQyxDQUFBO0FBQ2xDLDhCQUFzQixp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21tYW5kT3B0aW9uLmJsdWUgKyBcIiBub3QgcmVjb2duaXNlZFwiKTtcbiAgICAgICAgcHJvY2Vzcy5leGl0KDEpO1xuICAgICAgICBicmVhaztcbn1cblxuIl19 diff --git a/package.json b/package.json index 624f85f..a3ea7cb 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,8 @@ "npmci": "dist/index.js" }, "scripts": { - "test": "(npmts)" + "test": "(npmts) && (npm run testVersion)", + "testVersion":"node dist/index.js -v" }, "repository": { "type": "git", diff --git a/ts/index.ts b/ts/index.ts index f5822b1..da3a8f9 100644 --- a/ts/index.ts +++ b/ts/index.ts @@ -22,8 +22,8 @@ export {publish} from "./npmci.publish"; let command; let commandOption:string; -plugins.commander - .version(npmciInfo.version) +let commander = plugins.commander + .option("-v","--version","print version") .arguments(' [commandoptionarg]') .action(function (commandarg, commandoptionarg) { command = commandarg; @@ -31,7 +31,12 @@ plugins.commander }); plugins.commander.parse(process.argv); - + +if(commander.version) { + console.log(npmciInfo.version); + process.exit(0); +} + if (typeof command === 'undefined') { console.error('no command given!'); process.exit(1);