From 24a3af654caa0014af559cc15249c62afc071ad0 Mon Sep 17 00:00:00 2001 From: Evgeniy Timofeev Date: Wed, 4 Dec 2024 13:39:30 +0300 Subject: [PATCH] code review --- src/cli/commands/help.command.ts | 7 ++++--- src/shared/libs/file-writer/file-writer.interface.ts | 2 +- src/shared/libs/file-writer/tsv-file-writer.ts | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/cli/commands/help.command.ts b/src/cli/commands/help.command.ts index a729035..8adba5d 100644 --- a/src/cli/commands/help.command.ts +++ b/src/cli/commands/help.command.ts @@ -16,9 +16,10 @@ export class HelpCommand implements Command { ${logText('Пример:')} \t${logCommand('cli.js -- [--arguments]')} ${logText('Команды:')} - \t${logCommand('--version')}:\t\t${logCommandDescription('# выводит номер версии')} - \t${logCommand('--help')}:\t\t\t${logCommandDescription('# печатает этот текст')} - \t${logCommand('--import ')}:\t${logCommandDescription('# импортирует данные из TSV')} + \t${logCommand('--version')}:\t\t\t\t${logCommandDescription('# выводит номер версии')} + \t${logCommand('--help')}:\t\t\t\t\t${logCommandDescription('# печатает этот текст')} + \t${logCommand('--import ')}:\t\t\t${logCommandDescription('# импортирует данные из TSV')} + \t${logCommand('--generate ')}:\t${logCommandDescription('# получает данные из , генерирует предложений и сохраняет в файл ')} `); } } diff --git a/src/shared/libs/file-writer/file-writer.interface.ts b/src/shared/libs/file-writer/file-writer.interface.ts index 6d8afaa..818fe3e 100644 --- a/src/shared/libs/file-writer/file-writer.interface.ts +++ b/src/shared/libs/file-writer/file-writer.interface.ts @@ -1,3 +1,3 @@ export interface FileWriter { - write(row: string): void; + write(row: string): Promise; } diff --git a/src/shared/libs/file-writer/tsv-file-writer.ts b/src/shared/libs/file-writer/tsv-file-writer.ts index 9c2ddda..c7d7033 100644 --- a/src/shared/libs/file-writer/tsv-file-writer.ts +++ b/src/shared/libs/file-writer/tsv-file-writer.ts @@ -13,11 +13,11 @@ export class TSVFileWriter implements FileWriter { }); } - public async write(row: string): Promise { + public async write(row: string): Promise { const writeSuccess = this.stream.write(`${row}\n`); if (! writeSuccess) { return new Promise((resolve) => { - this.stream.once('drain', () => resolve(true)); + this.stream.once('drain', () => resolve()); }); }