Skip to content

Commit

Permalink
code review
Browse files Browse the repository at this point in the history
  • Loading branch information
Evgeniy Timofeev committed Dec 4, 2024
1 parent a2ea7ad commit 24a3af6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
7 changes: 4 additions & 3 deletions src/cli/commands/help.command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ export class HelpCommand implements Command {
${logText('Пример:')}
\t${logCommand('cli.js --<command> [--arguments]')}
${logText('Команды:')}
\t${logCommand('--version')}:\t\t${logCommandDescription('# выводит номер версии')}
\t${logCommand('--help')}:\t\t\t${logCommandDescription('# печатает этот текст')}
\t${logCommand('--import <path>')}:\t${logCommandDescription('# импортирует данные из TSV')}
\t${logCommand('--version')}:\t\t\t\t${logCommandDescription('# выводит номер версии')}
\t${logCommand('--help')}:\t\t\t\t\t${logCommandDescription('# печатает этот текст')}
\t${logCommand('--import <path>')}:\t\t\t${logCommandDescription('# импортирует данные из TSV')}
\t${logCommand('--generate <count> <path> <url>')}:\t${logCommandDescription('# получает данные из <url>, генерирует <count> предложений и сохраняет в файл <path>')}
`);
}
}
2 changes: 1 addition & 1 deletion src/shared/libs/file-writer/file-writer.interface.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export interface FileWriter {
write(row: string): void;
write(row: string): Promise<void>;
}
4 changes: 2 additions & 2 deletions src/shared/libs/file-writer/tsv-file-writer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ export class TSVFileWriter implements FileWriter {
});
}

public async write(row: string): Promise<unknown> {
public async write(row: string): Promise<void> {
const writeSuccess = this.stream.write(`${row}\n`);
if (! writeSuccess) {
return new Promise((resolve) => {
this.stream.once('drain', () => resolve(true));
this.stream.once('drain', () => resolve());
});
}

Expand Down

0 comments on commit 24a3af6

Please sign in to comment.