2016-10-09 21:14:02 +02:00
"use strict" ;
2014-08-19 03:53:17 +02:00
var program = require ( "commander" ) ;
var child = require ( "child_process" ) ;
2016-12-15 07:13:43 +01:00
var colors = require ( "colors/safe" ) ;
2014-10-01 18:43:46 +02:00
var Helper = require ( "../helper" ) ;
2014-08-19 03:53:17 +02:00
program
. command ( "config" )
2017-08-16 05:30:01 +02:00
. 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 ( ) {
2016-09-20 07:33:09 +02:00
var child _spawn = child . spawn (
2014-10-09 14:40:16 +02:00
process . env . EDITOR || "vi" ,
2016-05-08 08:21:31 +02:00
[ Helper . CONFIG _PATH ] ,
2014-08-19 03:53:17 +02:00
{ stdio : "inherit" }
) ;
2016-09-20 07:33:09 +02:00
child _spawn . on ( "error" , function ( ) {
2016-12-15 07:13:43 +01: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 07:33:09 +02:00
} ) ;
2014-08-19 03:53:17 +02:00
} ) ;