From e7beb545e8d0e140b1059974aec04acf84a17fbf Mon Sep 17 00:00:00 2001 From: Cris Mihalache Date: Thu, 14 Dec 2023 22:19:51 +0200 Subject: [PATCH] fix: sheet command --- src/commands/sheet.ts | 6 ++---- src/db/delete.ts | 3 +-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/commands/sheet.ts b/src/commands/sheet.ts index 529ebcf..ac694f6 100644 --- a/src/commands/sheet.ts +++ b/src/commands/sheet.ts @@ -13,8 +13,7 @@ const COMMAND_CONFIG = { aliases: ['s'], builder: { name: { - describe: 'Sheet name', - demandOption: true + describe: 'Sheet name' }, delete: { @@ -71,10 +70,9 @@ const handler = async (args: SheetCommandArgs) => { const { name, entries } = sheet if (entries.length === 0) { - console.log( + throw new Error( `${C.clText('Sheet')} ${C.clSheet(name)} ${C.clText('has no entries')}` ) - return } P.printSheet(sheet, name === activeSheetName) diff --git a/src/db/delete.ts b/src/db/delete.ts index 5d81fd2..6f13f02 100644 --- a/src/db/delete.ts +++ b/src/db/delete.ts @@ -11,8 +11,7 @@ const deleteDB = async (): Promise => { await fs.access(dbPath) await fs.rm(dbPath) } catch (err: unknown) { - console.error(`No DB exists at path ${dbPath}`) - throw err + throw new Error(`No DB exists at path ${dbPath}`) } }