const State = require('../State') class CommandState extends State { #ran_once = false static get services() { return [...super.services, 'output'] } async apply() { const cmd = `${this._config.cmd}` const result = await this._host.run(cmd) this.#ran_once = true } async check() { return this.#ran_once } async reverse() { if ( this._config.reverse ) { const cmd = `${this._config.reverse}` await this._host.run(cmd) } else { this.output.warn(`No reversal command specified for Command State. Nothing was changed. (Host: ${this._host.name})`) } } failure_message() { return `Failed to execute the command "${this._config.cmd}" on host "${this._host.name}."` } check_message() { return `The command check was not successful.` } display() { return `Run the command: ${this._config.cmd}` } } module.exports = exports = CommandState