mirror of
https://github.com/thelounge/thelounge.git
synced 2024-06-26 17:20:22 +02:00
a6aa40b1c1
* Fix the missing Helper method in the edit command to use Helper.HOME and the correct path assembly method (path.join) instead of joining strings together! * Use $EDITOR instead of "vi" in the event a user doesn't have "vi" installed or doesn't understand it. Fallback to "vi" in case user doesn't have $EDITOR set.
23 lines
632 B
JavaScript
23 lines
632 B
JavaScript
var ClientManager = new require("../clientManager");
|
|
var program = require("commander");
|
|
var child = require("child_process");
|
|
var Helper = require("../helper");
|
|
|
|
program
|
|
.command("edit <name>")
|
|
.description("Edit user: '" + Helper.HOME + "/users/<name>/user.json'")
|
|
.action(function(name) {
|
|
var users = new ClientManager().getUsers();
|
|
if (users.indexOf(name) === -1) {
|
|
console.log("");
|
|
console.log("User '" + name + "' doesn't exist.");
|
|
console.log("");
|
|
return;
|
|
}
|
|
child.spawn(
|
|
process.env.EDITOR || "vi",
|
|
[require("path").join(Helper.HOME, "users", name, "user.json")],
|
|
{stdio: "inherit"}
|
|
);
|
|
});
|