2016-10-09 19:14:02 +00:00
|
|
|
"use strict";
|
|
|
|
|
2014-08-19 01:53:17 +00:00
|
|
|
var program = require("commander");
|
|
|
|
var child = require("child_process");
|
2016-12-15 06:13:43 +00:00
|
|
|
var colors = require("colors/safe");
|
2014-10-01 16:43:46 +00:00
|
|
|
var Helper = require("../helper");
|
2017-08-21 05:49:32 +00:00
|
|
|
const Utils = require("./utils");
|
2014-08-19 01:53:17 +00:00
|
|
|
|
|
|
|
program
|
|
|
|
.command("config")
|
2017-08-21 05:49:32 +00:00
|
|
|
.description(`Edit configuration file located at ${colors.green(Helper.CONFIG_PATH)}.`)
|
|
|
|
.on("--help", Utils.extraHelp)
|
2014-08-19 01:53:17 +00:00
|
|
|
.action(function() {
|
2016-09-20 05:33:09 +00:00
|
|
|
var child_spawn = child.spawn(
|
2014-10-09 12:40:16 +00:00
|
|
|
process.env.EDITOR || "vi",
|
2016-05-08 06:21:31 +00:00
|
|
|
[Helper.CONFIG_PATH],
|
2014-08-19 01:53:17 +00:00
|
|
|
{stdio: "inherit"}
|
|
|
|
);
|
2016-09-20 05:33:09 +00:00
|
|
|
child_spawn.on("error", function() {
|
2016-12-15 06:13:43 +00:00
|
|
|
log.error(`Unable to open ${colors.green(Helper.CONFIG_PATH)}. ${colors.bold("$EDITOR")} is not set, and ${colors.bold("vi")} was not found.`);
|
2016-09-20 05:33:09 +00:00
|
|
|
});
|
2014-08-19 01:53:17 +00:00
|
|
|
});
|