mib-cli
Version:
CLI tool to manage projects
34 lines (23 loc) • 812 B
JavaScript
const autoComplete = require('../../util/auto-complete');
const spawn = require('child_process').spawn;
const projects = require('../../util/projects');
module.exports = function (vorpal, options) {
let chalk = vorpal.chalk;
vorpal
.command('node [project]')
.autocomplete(autoComplete.getFromProjects())
.description('Use this command to enter in js scripting mode, you can enter every standard node commands')
.action( function (args, callback) {
var self = this;
projects.go(args.project);
this.log(chalk.green('Entered in node scripting mode, you\'re leaving MIB quarter'));
vorpal.hide();
// Do the heavy work
let term = spawn('node', {stdio: 'inherit'});
term.on('exit', function() {
projects.back();
vorpal.show();
callback();
});
});
}