Add documentation for LOUNGE_HOME environment variable in the CLI helper
This commit is contained in:
parent
1e9910f899
commit
98bfe349d9
@ -4,10 +4,12 @@ var ClientManager = new require("../clientManager");
|
|||||||
var colors = require("colors/safe");
|
var colors = require("colors/safe");
|
||||||
var program = require("commander");
|
var program = require("commander");
|
||||||
var Helper = require("../helper");
|
var Helper = require("../helper");
|
||||||
|
const Utils = require("./utils");
|
||||||
|
|
||||||
program
|
program
|
||||||
.command("add <name>")
|
.command("add <name>")
|
||||||
.description("Add a new user")
|
.description("Add a new user")
|
||||||
|
.on("--help", Utils.extraHelp)
|
||||||
.action(function(name) {
|
.action(function(name) {
|
||||||
var manager = new ClientManager();
|
var manager = new ClientManager();
|
||||||
var users = manager.getUsers();
|
var users = manager.getUsers();
|
||||||
|
@ -4,10 +4,12 @@ var program = require("commander");
|
|||||||
var child = require("child_process");
|
var child = require("child_process");
|
||||||
var colors = require("colors/safe");
|
var colors = require("colors/safe");
|
||||||
var Helper = require("../helper");
|
var Helper = require("../helper");
|
||||||
|
const Utils = require("./utils");
|
||||||
|
|
||||||
program
|
program
|
||||||
.command("config")
|
.command("config")
|
||||||
.description(`Edit configuration file located at ${colors.green(Helper.CONFIG_PATH)}. Set the ${colors.green("LOUNGE_HOME")} environment variable to change.`)
|
.description(`Edit configuration file located at ${colors.green(Helper.CONFIG_PATH)}.`)
|
||||||
|
.on("--help", Utils.extraHelp)
|
||||||
.action(function() {
|
.action(function() {
|
||||||
var child_spawn = child.spawn(
|
var child_spawn = child.spawn(
|
||||||
process.env.EDITOR || "vi",
|
process.env.EDITOR || "vi",
|
||||||
|
@ -5,10 +5,12 @@ var program = require("commander");
|
|||||||
var child = require("child_process");
|
var child = require("child_process");
|
||||||
var colors = require("colors/safe");
|
var colors = require("colors/safe");
|
||||||
var Helper = require("../helper");
|
var Helper = require("../helper");
|
||||||
|
const Utils = require("./utils");
|
||||||
|
|
||||||
program
|
program
|
||||||
.command("edit <name>")
|
.command("edit <name>")
|
||||||
.description(`Edit user file located at ${colors.green(Helper.getUserConfigPath("<name>"))}.`)
|
.description(`Edit user file located at ${colors.green(Helper.getUserConfigPath("<name>"))}.`)
|
||||||
|
.on("--help", Utils.extraHelp)
|
||||||
.action(function(name) {
|
.action(function(name) {
|
||||||
var users = new ClientManager().getUsers();
|
var users = new ClientManager().getUsers();
|
||||||
if (users.indexOf(name) === -1) {
|
if (users.indexOf(name) === -1) {
|
||||||
|
@ -8,9 +8,11 @@ var fs = require("fs");
|
|||||||
var fsextra = require("fs-extra");
|
var fsextra = require("fs-extra");
|
||||||
var path = require("path");
|
var path = require("path");
|
||||||
var Helper = require("../helper");
|
var Helper = require("../helper");
|
||||||
|
const Utils = require("./utils");
|
||||||
|
|
||||||
program.version(Helper.getVersion(), "-v, --version")
|
program.version(Helper.getVersion(), "-v, --version")
|
||||||
.option("--home <path>", `${colors.bold("[DEPRECATED]")} Use the ${colors.green("LOUNGE_HOME")} environment variable instead.`)
|
.option("--home <path>", `${colors.bold("[DEPRECATED]")} Use the ${colors.green("LOUNGE_HOME")} environment variable instead.`)
|
||||||
|
.on("--help", Utils.extraHelp)
|
||||||
.parseOptions(process.argv);
|
.parseOptions(process.argv);
|
||||||
|
|
||||||
if (program.home) {
|
if (program.home) {
|
||||||
|
@ -3,10 +3,12 @@
|
|||||||
var ClientManager = new require("../clientManager");
|
var ClientManager = new require("../clientManager");
|
||||||
var program = require("commander");
|
var program = require("commander");
|
||||||
var colors = require("colors/safe");
|
var colors = require("colors/safe");
|
||||||
|
const Utils = require("./utils");
|
||||||
|
|
||||||
program
|
program
|
||||||
.command("list")
|
.command("list")
|
||||||
.description("List all users")
|
.description("List all users")
|
||||||
|
.on("--help", Utils.extraHelp)
|
||||||
.action(function() {
|
.action(function() {
|
||||||
var users = new ClientManager().getUsers();
|
var users = new ClientManager().getUsers();
|
||||||
if (!users.length) {
|
if (!users.length) {
|
||||||
|
@ -3,10 +3,12 @@
|
|||||||
var ClientManager = new require("../clientManager");
|
var ClientManager = new require("../clientManager");
|
||||||
var program = require("commander");
|
var program = require("commander");
|
||||||
var colors = require("colors/safe");
|
var colors = require("colors/safe");
|
||||||
|
const Utils = require("./utils");
|
||||||
|
|
||||||
program
|
program
|
||||||
.command("remove <name>")
|
.command("remove <name>")
|
||||||
.description("Remove an existing user")
|
.description("Remove an existing user")
|
||||||
|
.on("--help", Utils.extraHelp)
|
||||||
.action(function(name) {
|
.action(function(name) {
|
||||||
var manager = new ClientManager();
|
var manager = new ClientManager();
|
||||||
if (manager.removeUser(name)) {
|
if (manager.removeUser(name)) {
|
||||||
|
@ -5,10 +5,12 @@ var fs = require("fs");
|
|||||||
var program = require("commander");
|
var program = require("commander");
|
||||||
var colors = require("colors/safe");
|
var colors = require("colors/safe");
|
||||||
var Helper = require("../helper");
|
var Helper = require("../helper");
|
||||||
|
const Utils = require("./utils");
|
||||||
|
|
||||||
program
|
program
|
||||||
.command("reset <name>")
|
.command("reset <name>")
|
||||||
.description("Reset user password")
|
.description("Reset user password")
|
||||||
|
.on("--help", Utils.extraHelp)
|
||||||
.action(function(name) {
|
.action(function(name) {
|
||||||
var users = new ClientManager().getUsers();
|
var users = new ClientManager().getUsers();
|
||||||
if (users.indexOf(name) === -1) {
|
if (users.indexOf(name) === -1) {
|
||||||
|
@ -5,6 +5,7 @@ var program = require("commander");
|
|||||||
var colors = require("colors/safe");
|
var colors = require("colors/safe");
|
||||||
var server = require("../server");
|
var server = require("../server");
|
||||||
var Helper = require("../helper");
|
var Helper = require("../helper");
|
||||||
|
const Utils = require("./utils");
|
||||||
|
|
||||||
program
|
program
|
||||||
.command("start")
|
.command("start")
|
||||||
@ -14,6 +15,7 @@ program
|
|||||||
.option(" --public", "start in public mode")
|
.option(" --public", "start in public mode")
|
||||||
.option(" --private", "start in private mode")
|
.option(" --private", "start in private mode")
|
||||||
.description("Start the server")
|
.description("Start the server")
|
||||||
|
.on("--help", Utils.extraHelp)
|
||||||
.action(function(options) {
|
.action(function(options) {
|
||||||
var users = new ClientManager().getUsers();
|
var users = new ClientManager().getUsers();
|
||||||
|
|
||||||
|
18
src/command-line/utils.js
Normal file
18
src/command-line/utils.js
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
const colors = require("colors/safe");
|
||||||
|
|
||||||
|
class Utils {
|
||||||
|
static extraHelp() {
|
||||||
|
[
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
" Environment variable:",
|
||||||
|
"",
|
||||||
|
` LOUNGE_HOME Path for all configuration files and folders. Defaults to ${colors.green("~/.lounge")}.`,
|
||||||
|
"",
|
||||||
|
].forEach((e) => console.log(e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = Utils;
|
Loading…
Reference in New Issue
Block a user