2014-08-25 00:19:03 +00:00
|
|
|
var ClientManager = new require("../clientManager");
|
|
|
|
var program = require("commander");
|
|
|
|
var child = require("child_process");
|
2014-09-13 12:23:17 +00:00
|
|
|
var Helper = require("../helper");
|
2014-08-26 18:00:12 +00:00
|
|
|
|
2014-08-25 00:19:03 +00:00
|
|
|
program
|
|
|
|
.command("edit <name>")
|
2016-05-08 06:21:31 +00:00
|
|
|
.description("Edit user: " + Helper.getUserConfigPath("<name>"))
|
2014-08-25 00:19:03 +00:00
|
|
|
.action(function(name) {
|
|
|
|
var users = new ClientManager().getUsers();
|
|
|
|
if (users.indexOf(name) === -1) {
|
2016-04-16 11:32:38 +00:00
|
|
|
log.error("User '" + name + "' doesn't exist.");
|
2014-08-25 00:19:03 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
child.spawn(
|
2014-10-09 08:27:36 +00:00
|
|
|
process.env.EDITOR || "vi",
|
2016-05-08 06:21:31 +00:00
|
|
|
[Helper.getUserConfigPath(name)],
|
2014-08-25 00:19:03 +00:00
|
|
|
{stdio: "inherit"}
|
|
|
|
);
|
|
|
|
});
|