mirror of
https://github.com/thelounge/thelounge.git
synced 2024-05-03 06:53:40 +02:00
815319810c
The user folder gets created on demand, thelounge list should not fail if the folder doesn't exist. This just means that no users are present, so report that instead.
35 lines
737 B
JavaScript
35 lines
737 B
JavaScript
"use strict";
|
|
|
|
const log = require("../../log");
|
|
const colors = require("chalk");
|
|
const program = require("commander");
|
|
const Utils = require("../utils");
|
|
|
|
program
|
|
.command("list")
|
|
.description("List all users")
|
|
.on("--help", Utils.extraHelp)
|
|
.action(function () {
|
|
const ClientManager = require("../../clientManager");
|
|
const users = new ClientManager().getUsers();
|
|
|
|
if (users === undefined) {
|
|
// There was an error, already logged
|
|
return;
|
|
}
|
|
|
|
if (users.length === 0) {
|
|
log.info(
|
|
`There are currently no users. Create one with ${colors.bold(
|
|
"thelounge add <name>"
|
|
)}.`
|
|
);
|
|
return;
|
|
}
|
|
|
|
log.info("Users:");
|
|
users.forEach((user, i) => {
|
|
log.info(`${i + 1}. ${colors.bold(user)}`);
|
|
});
|
|
});
|