* Logs an event for a command (e.g. start, stop). * * If raw mode is on, then nothing is logged.
(text: string, command: Command)
| 256 | * If raw mode is on, then nothing is logged. |
| 257 | */ |
| 258 | logCommandEvent(text: string, command: Command) { |
| 259 | if (this.raw) { |
| 260 | return; |
| 261 | } |
| 262 | |
| 263 | // Last write was from this command, but it didn't end with a line feed. |
| 264 | // Prepend one, otherwise the event's text will be concatenated to that write. |
| 265 | // A line feed is otherwise inserted anyway. |
| 266 | let prefix = ''; |
| 267 | if (this.lastWrite?.command === command && this.lastWrite.char !== '\n') { |
| 268 | prefix = '\n'; |
| 269 | } |
| 270 | this.logCommandText(`${prefix}${this.chalk.reset(text)}\n`, command); |
| 271 | } |
| 272 | |
| 273 | logCommandText(text: string, command: Command) { |
| 274 | if (this.hide.includes(String(command.index)) || this.hide.includes(command.name)) { |
no test coverage detected