Added 'shout edit' command
This commit is contained in:
parent
100d3dee18
commit
4c2e1e24f7
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "shout",
|
||||
"description": "A web IRC client",
|
||||
"version": "0.10.5",
|
||||
"version": "0.10.6",
|
||||
"author": "Mattias Erming",
|
||||
"preferGlobal": true,
|
||||
"bin": {
|
||||
|
|
|
@ -7,7 +7,7 @@ program
|
|||
.action(function() {
|
||||
child.spawn(
|
||||
"sudo",
|
||||
["vim", process.cwd() + "/config.json"],
|
||||
["vi", process.cwd() + "/config.json"],
|
||||
{stdio: "inherit"}
|
||||
);
|
||||
});
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
var ClientManager = new require("../clientManager");
|
||||
var program = require("commander");
|
||||
var child = require("child_process");
|
||||
|
||||
program
|
||||
.command("edit <name>")
|
||||
.description("Edit existing user")
|
||||
.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(
|
||||
"sudo",
|
||||
["vi", process.cwd() + "/users/" + name + "/user.json"],
|
||||
{stdio: "inherit"}
|
||||
);
|
||||
});
|
|
@ -5,6 +5,7 @@ require("./config");
|
|||
require("./list");
|
||||
require("./add");
|
||||
require("./remove");
|
||||
require("./edit");
|
||||
|
||||
program
|
||||
.option("-p, --port <port>")
|
||||
|
|
|
@ -19,8 +19,7 @@ program
|
|||
return;
|
||||
}
|
||||
var manager = new ClientManager();
|
||||
var success = manager.removeUser(name);
|
||||
if (success) {
|
||||
if (manager.removeUser(name)) {
|
||||
console.log("");
|
||||
console.log("Removed '" + name + "'.");
|
||||
console.log("");
|
||||
|
|
Loading…
Reference in New Issue