@athenna/core
Version:
One foundation for multiple applications.
38 lines (37 loc) • 892 B
JavaScript
/**
* @athenna/core
*
* (c) João Lenon <lenon@athenna.io>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
export class CommandBuilder {
constructor(signature, session) {
this.signature = signature;
this.session = session;
this.options = {};
}
/**
* Set the command help that will be displayed when running
* the .help command.
*/
help(help) {
this.options.help = help;
return this;
}
/**
* Set the command action that will be executed when running
* the command.
*/
action(action) {
this.options.action = action;
return this;
}
/**
* Register the command in the repl session.
*/
register() {
this.session.defineCommand(this.signature, this.options);
}
}