@qbyco/tjs-cli
Version:
TrafaletJS CLI Tool
65 lines (55 loc) • 1.14 kB
JavaScript
/**
* @module lib/cli
*/
const EventEmitter = require("events").EventEmitter;
const Parser = require("./Parser/Parser");
const Command = require("./Command/Command");
const Repository = require("./Command/Repository");
const Executor = require("./Command/Executor");
class CLI extends EventEmitter {
/**
* @constructor
* @param args
*/
constructor (...args) {
super(...args);
this.command = new Command();
this.parser = new Parser(this.command);
this.repository = new Repository();
this.executor = new Executor(this);
}
/**
* @method getCommand
* @returns {Command}
*/
getCommand () {
return this.command;
}
/**
* @method getRepository
* @returns {Repository}
*/
getRepository() {
return this.repository;
}
/**
* @method getExecutor
* @returns {Executor}
*/
getExecutor() {
return this.executor;
}
/**
* @method take
* @param {Array} input
*/
take(input) {
if (0 < input.length) {
this.parser.parse(input);
}
}
}
/**
* Exports the object for CLICommand
*/
module.exports = CLI;