thelounge/src/command-line/config.js

21 lines
685 B
JavaScript
Raw Normal View History

"use strict";
2014-08-19 03:53:17 +02:00
var program = require("commander");
var child = require("child_process");
var colors = require("colors/safe");
var Helper = require("../helper");
2014-08-19 03:53:17 +02:00
program
.command("config")
.description(`Edit configuration file located at ${colors.green(Helper.CONFIG_PATH)}. Set the ${colors.green("LOUNGE_HOME")} environment variable to change.`)
2014-08-19 03:53:17 +02:00
.action(function() {
var child_spawn = child.spawn(
process.env.EDITOR || "vi",
[Helper.CONFIG_PATH],
2014-08-19 03:53:17 +02:00
{stdio: "inherit"}
);
child_spawn.on("error", function() {
log.error(`Unable to open ${colors.green(Helper.CONFIG_PATH)}. ${colors.bold("$EDITOR")} is not set, and ${colors.bold("vi")} was not found.`);
});
2014-08-19 03:53:17 +02:00
});