mirror of
https://github.com/thelounge/thelounge
synced 2024-11-10 14:44:13 +00:00
Update cli commands
This commit is contained in:
parent
6c94d7188b
commit
b36e069895
4 changed files with 14 additions and 14 deletions
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"port": 9000,
|
||||
"theme": "themes/example.css",
|
||||
"public": false
|
||||
"public": true
|
||||
}
|
||||
|
|
18
index.js
18
index.js
|
@ -8,26 +8,26 @@ var shout = require("./src/server.js");
|
|||
var fs = require("fs");
|
||||
|
||||
program
|
||||
.option("-p, --port <port>")
|
||||
.option("-P, --public");
|
||||
.option("-p, --port <port>");
|
||||
|
||||
program
|
||||
.command("start")
|
||||
.description("Start the server")
|
||||
.action(function() {
|
||||
var users = new ClientManager().getUsers();
|
||||
if (!program.public && !users.length) {
|
||||
if (!config.public && !users.length) {
|
||||
console.log("");
|
||||
console.log("No users found!");
|
||||
console.log("Create a new user with 'shout add-user <name>'.")
|
||||
console.log("");
|
||||
} else {
|
||||
shout(program.port, program.public);
|
||||
var port = program.port || config.port;
|
||||
shout(port, config.public);
|
||||
}
|
||||
});
|
||||
|
||||
program
|
||||
.command("list-users")
|
||||
.command("list")
|
||||
.description("List all existing users")
|
||||
.action(function() {
|
||||
var users = new ClientManager().getUsers();
|
||||
|
@ -39,14 +39,14 @@ program
|
|||
console.log("");
|
||||
console.log("Users:");
|
||||
for (var i = 0; i < users.length; i++) {
|
||||
console.log((i + 1) + ": " + users[i]);
|
||||
console.log(" " + (i + 1) + ". " + users[i]);
|
||||
}
|
||||
console.log("");
|
||||
}
|
||||
});
|
||||
|
||||
program
|
||||
.command("add-user <name>")
|
||||
.command("add <name>")
|
||||
.description("Add a new user")
|
||||
.action(function(name) {
|
||||
try {
|
||||
|
@ -86,7 +86,7 @@ program
|
|||
});
|
||||
|
||||
program
|
||||
.command("remove-user <name>")
|
||||
.command("remove <name>")
|
||||
.description("Remove an existing user")
|
||||
.action(function(name) {
|
||||
try {
|
||||
|
@ -117,5 +117,5 @@ program
|
|||
program.parse(process.argv)
|
||||
|
||||
if (!program.args.length) {
|
||||
program.help();
|
||||
program.parse(process.argv.concat("start"));
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "shout",
|
||||
"description": "A web IRC client",
|
||||
"version": "0.9.11",
|
||||
"version": "0.10.0",
|
||||
"author": "Mattias Erming",
|
||||
"preferGlobal": true,
|
||||
"bin": {
|
||||
|
|
|
@ -26,9 +26,9 @@ var inputs = [
|
|||
"whois"
|
||||
];
|
||||
|
||||
module.exports = function(port, public) {
|
||||
config.port = port || config.port,
|
||||
config.public = public || config.public
|
||||
module.exports = function(port, isPublic) {
|
||||
config.port = port;
|
||||
config.public = isPublic;
|
||||
|
||||
var app = http()
|
||||
.use(index)
|
||||
|
|
Loading…
Reference in a new issue