add version commandline option
This commit is contained in:
parent
57fe78c673
commit
0f0eaf4c4f
3
dist/index.js
vendored
3
dist/index.js
vendored
File diff suppressed because one or more lines are too long
2
dist/npmci.ssh.d.ts
vendored
2
dist/npmci.ssh.d.ts
vendored
@ -1,3 +1,3 @@
|
||||
import "typings-global";
|
||||
export declare let ssh: () => void;
|
||||
export declare let evaluateSshkey: () => void;
|
||||
export declare let evaluateSshkey: (sshkeyEnvVarArg: any) => void;
|
||||
|
20
dist/npmci.ssh.js
vendored
20
dist/npmci.ssh.js
vendored
@ -1,11 +1,25 @@
|
||||
"use strict";
|
||||
require("typings-global");
|
||||
var plugins = require("./npmci.plugins");
|
||||
var sshRegex = /^(.*)\|?(.*)\|?(.*)/;
|
||||
var sshInstance;
|
||||
exports.ssh = function () {
|
||||
var sshInstance = new plugins.smartssh.SshInstance();
|
||||
sshInstance = new plugins.smartssh.SshInstance();
|
||||
plugins.smartparam.forEachMinimatch(process.env, "NPMCI_SSHKEY_*", exports.evaluateSshkey);
|
||||
sshInstance.sync("to");
|
||||
};
|
||||
exports.evaluateSshkey = function () {
|
||||
exports.evaluateSshkey = function (sshkeyEnvVarArg) {
|
||||
var resultArray = sshRegex.exec(sshkeyEnvVarArg);
|
||||
var sshKey = new plugins.smartssh.SshKey();
|
||||
if (resultArray[1] && resultArray[1] != "undefined")
|
||||
sshKey.privateKeyBase64 = resultArray[1];
|
||||
var publicKey;
|
||||
if (resultArray[2] && resultArray[2] != "undefined")
|
||||
sshKey.publicKeyBase64 = resultArray[2];
|
||||
var host;
|
||||
if (resultArray[3] && resultArray[3] != "undefined")
|
||||
sshKey.host = resultArray[1];
|
||||
sshInstance.addKey(sshKey);
|
||||
};
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5wbWNpLnNzaC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsUUFBTyxnQkFBZ0IsQ0FBQyxDQ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cnJheVsyXSAmJiByZXN1bHRBcnJheVsyXSAhPSBcInVuZGVmaW5lZFwiKSBzc2hLZXkucHVibGljS2V5QmFzZTY0ID0gcmVzdWx0QXJyYXlbMl07XG4gICAgbGV0IGhvc3Q6c3RyaW5nO1xuICAgIGlmKHJlc3VsdEFycmF5WzNdICYmIHJlc3VsdEFycmF5WzNdICE9IFwidW5kZWZpbmVkXCIpIHNzaEtleS5ob3N0ID0gcmVzdWx0QXJyYXlbMV07XG4gICAgXG4gICAgc3NoSW5zdGFuY2UuYWRkS2V5KHNzaEtleSk7XG59OyJdfQ==
|
||||
|
@ -23,6 +23,7 @@ let command;
|
||||
let commandOption:string;
|
||||
|
||||
plugins.commander
|
||||
.version(npmciInfo.version)
|
||||
.arguments('<commandarg> [commandoptionarg]')
|
||||
.action(function (commandarg, commandoptionarg) {
|
||||
command = commandarg;
|
||||
|
@ -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);
|
||||
};
|
Loading…
Reference in New Issue
Block a user