From 2335981e489ef692c866c294dce33c56769e71f8 Mon Sep 17 00:00:00 2001 From: Peter Date: Mon, 8 Nov 2021 08:58:50 +0300 Subject: [PATCH] feat(parameter date): parameter date in sendlogs is optional now --- src/commands/SendLogsCommand.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/commands/SendLogsCommand.ts b/src/commands/SendLogsCommand.ts index b61bcf5..19f6fd4 100644 --- a/src/commands/SendLogsCommand.ts +++ b/src/commands/SendLogsCommand.ts @@ -18,7 +18,7 @@ class SendLogsCommand extends AbstractCommand { description: string = 'Команда отправки логов'; protected bindOptions(command: Command) { - command.requiredOption('--date ', 'дата в формате ISO', /^\d{4}-\d\d-\d\d$/); + command.option('--date ', 'дата в формате ISO', /^\d{4}-\d\d-\d\d$/); } /** @@ -26,7 +26,11 @@ class SendLogsCommand extends AbstractCommand { */ protected action = async (options: SendLogsCommandOptions) => { await new Promise(resolve => { - this.validateOptions(options); + // this.validateOptions(options); + if (!options.date) { + // eslint-disable-next-line no-param-reassign + options.date = new Date().toISOString().substring(0, 10); + } const logEntries = LogPersistenceService.getUnsentDayLogEntries(options.date); if (logEntries.entries.length === 0) {