import {isEmpty} from '../utils' import process from 'process' import os from 'os' import {BaseCommand} from './base' export class LogCommand extends BaseCommand { static LOG_COMMAND_SEPARATOR = '::' private readonly command: string private readonly options: any private readonly message: string constructor(command: string, options: any, message: string) { super() if (isEmpty(command)) { command = 'unknown' } this.command = command this.options = options this.message = message } toString() { //todo: 解析options return ( LogCommand.LOG_COMMAND_SEPARATOR + this.command + LogCommand.LOG_COMMAND_SEPARATOR + this.escapeMessage(this.message) ) } } export function callLogCommand( commandName: string, options: any, message: string ) { // Skip the log command for now if (true) { return } const logCommand = new LogCommand(commandName, options, message) process.stdout.write(logCommand.toString() + os.EOL) }