From 4bda7a923025bee5251229531c0a33a07107dbd0 Mon Sep 17 00:00:00 2001 From: kamtschatka Date: Sat, 5 Oct 2024 15:37:39 +0200 Subject: feature(cli): Add ability to get all bookmark IDs of a list. Fixes #442 (#446) Added a command that returns the ids of the bookmarks in a list --- apps/cli/src/commands/lists.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'apps/cli/src') diff --git a/apps/cli/src/commands/lists.ts b/apps/cli/src/commands/lists.ts index 855624d6..4b157cdf 100644 --- a/apps/cli/src/commands/lists.ts +++ b/apps/cli/src/commands/lists.ts @@ -82,6 +82,24 @@ export async function addToList(listId: string, bookmarkId: string) { ); } +listsCmd + .command("get") + .description("gets all the ids of the bookmarks assigned to the list") + .requiredOption("--list ", "the id of the list") + .action(async (opts) => { + const api = getAPIClient(); + try { + const results = await api.lists.get.query({ listId: opts.list }); + + printObject(results.bookmarks); + } catch (error) { + printErrorMessageWithReason( + "Failed to get the ids of the bookmarks in the list", + error as object, + ); + } + }); + listsCmd .command("add-bookmark") .description("add a bookmark to list") -- cgit v1.2.3-70-g09d2