This commit is contained in:
Nebel 2023-11-19 20:51:29 +09:00
parent fb47c95173
commit ef7445ab10
Signed by: nebel
GPG key ID: 79807D08C6EF6460
2 changed files with 11 additions and 2 deletions

View file

@ -16,8 +16,9 @@ export function createLibrary(db: Database) {
readerUrl, readerUrl,
platform, platform,
); );
},
console.log(readerUrl); async delete(id: number) {
await db.run(`delete from books where id = ?`, id);
}, },
async getBooks(): Promise<Array<Book>> { async getBooks(): Promise<Array<Book>> {
const books: Array<Book> = await db.all( const books: Array<Book> = await db.all(

View file

@ -42,6 +42,14 @@ const options = {
await library.add(args.values.add!); 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: { list: {
type: "boolean", type: "boolean",
short: "l", short: "l",