delete
This commit is contained in:
parent
fb47c95173
commit
ef7445ab10
2 changed files with 11 additions and 2 deletions
|
@ -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(
|
||||||
|
|
8
main.ts
8
main.ts
|
@ -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",
|
||||||
|
|
Loading…
Add table
Reference in a new issue