Skip to content

Commit

Permalink
fix(cli): Allow bookmark listing to fetch all pages instead of only t…
Browse files Browse the repository at this point in the history
…he first one. Fixes #135
  • Loading branch information
MohamedBassem committed May 5, 2024
1 parent 81e49fa commit 27f45d5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion apps/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://json.schemastore.org/package.json",
"name": "@hoarderapp/cli",
"version": "0.12.2",
"version": "0.13.0",
"description": "Command Line Interface (CLI) for Hoarder",
"license": "GNU Affero General Public License version 3",
"keywords": [
Expand Down
19 changes: 16 additions & 3 deletions apps/cli/src/commands/bookmarks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,24 @@ bookmarkCmd
.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({

const request = {
archived: opts.includeArchived ? undefined : false,
listId: opts.listId,
});
console.log(resp.bookmarks.map(normalizeBookmark));
};

let results: ZBookmark[] = [];
let resp = await api.bookmarks.getBookmarks.query(request);

while (resp.nextCursor) {
resp = await api.bookmarks.getBookmarks.query({
...request,
cursor: resp.nextCursor,
});
results = [...results, ...resp.bookmarks];
}

console.log(results.map(normalizeBookmark));
});

bookmarkCmd
Expand Down

0 comments on commit 27f45d5

Please sign in to comment.