mirror of
https://github.com/thelounge/thelounge
synced 2024-11-29 07:20:25 +00:00
dd05ee3a65
Co-authored-by: Eric Nemchik <eric@nemchik.com> Co-authored-by: Pavel Djundik <xPaw@users.noreply.github.com>
34 lines
769 B
TypeScript
34 lines
769 B
TypeScript
import log from "../../log";
|
|
import colors from "chalk";
|
|
import {Command} from "commander";
|
|
import Utils from "../utils";
|
|
|
|
const program = new Command("list");
|
|
program
|
|
.description("List all users")
|
|
.on("--help", Utils.extraHelp)
|
|
.action(async function () {
|
|
const ClientManager = (await import("../../clientManager")).default;
|
|
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)}`);
|
|
});
|
|
});
|
|
|
|
export default program;
|