add version commandline option

This commit is contained in:
2016-06-24 02:54:55 +02:00
parent 57fe78c673
commit 0f0eaf4c4f
5 changed files with 36 additions and 7 deletions

View File

@ -23,6 +23,7 @@ let command;
let commandOption:string;
plugins.commander
.version(npmciInfo.version)
.arguments('<commandarg> [commandoptionarg]')
.action(function (commandarg, commandoptionarg) {
command = commandarg;

View File

@ -1,11 +1,24 @@
import "typings-global";
import * as plugins from "./npmci.plugins";
let sshRegex = /^(.*)\|?(.*)\|?(.*)/
let sshInstance:plugins.smartssh.SshInstance;
export let ssh = () => {
let sshInstance = new plugins.smartssh.SshInstance();
sshInstance = new plugins.smartssh.SshInstance();
plugins.smartparam.forEachMinimatch(process.env,"NPMCI_SSHKEY_*",evaluateSshkey);
sshInstance.sync("to");
};
export let evaluateSshkey = () => {
export let evaluateSshkey = (sshkeyEnvVarArg) => {
let resultArray = sshRegex.exec(sshkeyEnvVarArg);
let sshKey = new plugins.smartssh.SshKey();
if(resultArray[1] && resultArray[1] != "undefined") sshKey.privateKeyBase64 = resultArray[1];
let publicKey:string;
if(resultArray[2] && resultArray[2] != "undefined") sshKey.publicKeyBase64 = resultArray[2];
let host:string;
if(resultArray[3] && resultArray[3] != "undefined") sshKey.host = resultArray[1];
sshInstance.addKey(sshKey);
};