aboutsummaryrefslogtreecommitdiffstats
path: root/apps/cli/commands/bookmarks.ts
diff options
context:
space:
mode:
authorMohamedBassem <me@mbassem.com>2024-04-24 11:08:30 +0100
committerMohamedBassem <me@mbassem.com>2024-04-24 11:08:30 +0100
commitaf0cf9c1ee10901ab91b04a1d73afdcb2191a88f (patch)
treec1d46b198ef7964fbc2199477affc96ed2016932 /apps/cli/commands/bookmarks.ts
parent5dac180f486cbc6bb202debd5dde996a9c8204b4 (diff)
downloadkarakeep-af0cf9c1ee10901ab91b04a1d73afdcb2191a88f.tar.zst
feature(cli): Add ability to manipulate lists, tags and update bookmarks
Diffstat (limited to 'apps/cli/commands/bookmarks.ts')
-rw-r--r--apps/cli/commands/bookmarks.ts23
1 files changed, 23 insertions, 0 deletions
diff --git a/apps/cli/commands/bookmarks.ts b/apps/cli/commands/bookmarks.ts
index 55c87b05..0da3dd71 100644
--- a/apps/cli/commands/bookmarks.ts
+++ b/apps/cli/commands/bookmarks.ts
@@ -86,6 +86,27 @@ bookmarkCmd
});
bookmarkCmd
+ .command("update")
+ .description("Archive a bookmark")
+ .option("--title <title>", "If set, the bookmark's title will be updated")
+ .option("--note <note>", "If set, the bookmark's note will be updated")
+ .option("--archive", "If set, the bookmark will be archived")
+ .option("--no-archive", "If set, the bookmark will be unarchived")
+ .option("--favourite", "If set, the bookmark will be favourited")
+ .option("--no-favourite", "If set, the bookmark will be unfavourited")
+ .argument("<id>", "The id of the bookmark to get")
+ .action(async (id, opts) => {
+ const api = getAPIClient();
+ const resp = await api.bookmarks.updateBookmark.mutate({
+ bookmarkId: id,
+ archived: opts.archive,
+ favourited: opts.favourite,
+ title: opts.title,
+ });
+ console.log(resp);
+ });
+
+bookmarkCmd
.command("list")
.description("list all bookmarks")
.option(
@@ -93,10 +114,12 @@ bookmarkCmd
"If set, archived bookmarks will be fetched as well",
false,
)
+ .option("--list-id <id>", "If set, only items from that list will be fetched")
.action(async (opts) => {
const api = getAPIClient();
const resp = await api.bookmarks.getBookmarks.query({
archived: opts.includeArchived ? undefined : false,
+ listId: opts.listId,
});
console.log(resp.bookmarks.map(normalizeBookmark));
});