smartssh/dist/smartssh.classes.sshdir.js

39 lines
4.2 KiB
JavaScript
Raw Normal View History

"use strict";
require("typings-global");
2016-06-01 00:31:29 +00:00
var plugins = require("./smartssh.plugins");
var helpers = require("./smartssh.classes.helpers");
var SshDir = (function () {
2016-06-25 13:30:57 +00:00
function SshDir(sshKeyArray, sshConfig, sshDirPathArg) {
2016-06-26 14:16:12 +00:00
this._sshKeyArray = sshKeyArray;
this._sshConfig = sshConfig;
2016-06-01 00:31:29 +00:00
if (sshDirPathArg) {
2016-06-26 14:16:12 +00:00
this._path = sshDirPathArg;
2016-06-01 00:31:29 +00:00
}
else {
2016-06-26 14:16:12 +00:00
this._path = plugins.path.join(plugins.smartpath.get.home(), ".ssh/");
2016-06-01 00:31:29 +00:00
}
2016-06-25 00:29:34 +00:00
;
}
2016-06-24 00:49:55 +00:00
SshDir.prototype.writeToDir = function () {
2016-06-25 00:29:34 +00:00
var _this = this;
2016-06-26 14:16:12 +00:00
this._sshKeyArray.forEach(function (sshKeyArg) {
sshKeyArg.store(_this._path);
2016-06-25 00:29:34 +00:00
});
2016-06-26 14:16:12 +00:00
this._sshConfig.store(this._path);
};
;
2016-06-24 00:49:55 +00:00
SshDir.prototype.readFromDir = function () {
2016-06-01 00:31:29 +00:00
};
2016-06-26 14:16:12 +00:00
SshDir.prototype.updateDirPath = function (dirPathArg) {
this._path = dirPathArg;
};
;
SshDir.prototype.getKeys = function () {
2016-06-26 14:16:12 +00:00
return helpers.sshKeyArrayFromDir(this._path);
};
return SshDir;
}());
exports.SshDir = SshDir;
2016-06-26 14:16:12 +00:00
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0c3NoLmNsYXNzZXMuc3NoZGlyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxRQUFPLGdCQUFnQixDQUFDLENBQUE7QUFDeEIsSUFBWSxPQUFPLFdBQU0sb0JBQW9CLENBQUMsQ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