add removeKey and replaceKey methods

This commit is contained in:
Philipp Kunz 2016-04-26 05:04:36 +02:00
parent 1663d9a266
commit 1d17dd1b84
2 changed files with 13 additions and 1 deletions

View File

@ -3,6 +3,10 @@ import plugins = require("./smartssh.plugins");
import classes = require("./smartssh.classes"); import classes = require("./smartssh.classes");
export let sshKeyArrayFromDir = function(dirArg:string):classes.sshKey[]{ export let sshKeyArrayFromDir = function(dirArg:string):classes.sshKey[]{
let sshKeyArray = []; let sshKeyArray = []; //TODO
return sshKeyArray; return sshKeyArray;
} }
export let getKeyIndex = function(hostArg:string){
return 0; //TODO
}

View File

@ -26,6 +26,14 @@ export class ssh {
return undefined; return undefined;
} }
}; };
removeKey(sshKeyArg:sshKey){
let keyIndex = helpers.getKeyIndex(sshKeyArg.host);
this.sshKeys.splice(keyIndex,1);
};
replaceKey(sshKeyOldArg:sshKey,sshKeyNewArg:sshKey){
let keyIndex = helpers.getKeyIndex(sshKeyOldArg.host);
this.sshKeys.splice(keyIndex,1,sshKeyNewArg);
};
sync(){ sync(){
this.sshDir.sync(this.sshConfig,this.sshKeys); //call sync method of sshDir class; this.sshDir.sync(this.sshConfig,this.sshKeys); //call sync method of sshDir class;
}; };