From 1d17dd1b84127e886bc562900d156c1c4585fe8b Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Tue, 26 Apr 2016 05:04:36 +0200 Subject: [PATCH] add removeKey and replaceKey methods --- ts/smartssh.classes.helpers.ts | 6 +++++- ts/smartssh.classes.ts | 8 ++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ts/smartssh.classes.helpers.ts b/ts/smartssh.classes.helpers.ts index 887dbaf..b6d580e 100644 --- a/ts/smartssh.classes.helpers.ts +++ b/ts/smartssh.classes.helpers.ts @@ -3,6 +3,10 @@ import plugins = require("./smartssh.plugins"); import classes = require("./smartssh.classes"); export let sshKeyArrayFromDir = function(dirArg:string):classes.sshKey[]{ - let sshKeyArray = []; + let sshKeyArray = []; //TODO return sshKeyArray; +} + +export let getKeyIndex = function(hostArg:string){ + return 0; //TODO } \ No newline at end of file diff --git a/ts/smartssh.classes.ts b/ts/smartssh.classes.ts index ecadd8b..a8b36d4 100644 --- a/ts/smartssh.classes.ts +++ b/ts/smartssh.classes.ts @@ -26,6 +26,14 @@ export class ssh { 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(){ this.sshDir.sync(this.sshConfig,this.sshKeys); //call sync method of sshDir class; };