hardlounge/src/command-line/list.js

23 lines
600 B
JavaScript
Raw Normal View History

"use strict";
2014-09-13 21:29:45 +00:00
var ClientManager = new require("../clientManager");
var program = require("commander");
var colors = require("colors/safe");
const Utils = require("./utils");
2014-09-13 21:29:45 +00:00
program
.command("list")
2014-10-03 23:33:44 +00:00
.description("List all users")
.on("--help", Utils.extraHelp)
2014-09-13 21:29:45 +00:00
.action(function() {
var users = new ClientManager().getUsers();
if (!users.length) {
log.info(`There are currently no users. Create one with ${colors.bold("lounge add <name>")}.`);
2014-09-13 21:29:45 +00:00
} else {
log.info("Users:");
2014-09-13 21:29:45 +00:00
for (var i = 0; i < users.length; i++) {
log.info(`${i + 1}. ${colors.bold(users[i])}`);
2014-09-13 21:29:45 +00:00
}
}
});