diff --git a/library.ts b/library.ts index c8b9270..3b3b5a4 100644 --- a/library.ts +++ b/library.ts @@ -16,8 +16,9 @@ export function createLibrary(db: Database) { readerUrl, platform, ); - - console.log(readerUrl); + }, + async delete(id: number) { + await db.run(`delete from books where id = ?`, id); }, async getBooks(): Promise> { const books: Array = await db.all( diff --git a/main.ts b/main.ts index 5477b24..65f1093 100644 --- a/main.ts +++ b/main.ts @@ -42,6 +42,14 @@ const options = { await library.add(args.values.add!); }, }, + delete: { + type: "string", + async run() { + const db = await createDatabase(args.values.db!); + const library = createLibrary(db); + await library.delete(Number(args.values.delete)); + }, + }, list: { type: "boolean", short: "l",