diff options
Diffstat (limited to 'apps/cli/src')
| -rw-r--r-- | apps/cli/src/commands/bookmarks.ts | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/apps/cli/src/commands/bookmarks.ts b/apps/cli/src/commands/bookmarks.ts index 40442ec1..6efb41d9 100644 --- a/apps/cli/src/commands/bookmarks.ts +++ b/apps/cli/src/commands/bookmarks.ts @@ -9,7 +9,10 @@ import { getAPIClient } from "@/lib/trpc"; import { Command } from "@commander-js/extra-typings"; import type { ZBookmark } from "@hoarder/shared/types/bookmarks"; -import { MAX_NUM_BOOKMARKS_PER_PAGE } from "@hoarder/shared/types/bookmarks"; +import { + BookmarkTypes, + MAX_NUM_BOOKMARKS_PER_PAGE, +} from "@hoarder/shared/types/bookmarks"; export const bookmarkCmd = new Command() .name("bookmarks") @@ -26,7 +29,7 @@ function normalizeBookmark(bookmark: ZBookmark) { tags: bookmark.tags.map((t) => t.name), }; - if (ret.content.type == "link" && ret.content.htmlContent) { + if (ret.content.type == BookmarkTypes.LINK && ret.content.htmlContent) { if (ret.content.htmlContent.length > 10) { ret.content.htmlContent = ret.content.htmlContent.substring(0, 10) + "... <CROPPED>"; @@ -63,7 +66,7 @@ bookmarkCmd const promises = [ ...opts.link.map((url) => api.bookmarks.createBookmark - .mutate({ type: "link", url }) + .mutate({ type: BookmarkTypes.LINK, url }) .then((bookmark: ZBookmark) => { results.push(normalizeBookmark(bookmark)); }) @@ -71,7 +74,7 @@ bookmarkCmd ), ...opts.note.map((text) => api.bookmarks.createBookmark - .mutate({ type: "text", text }) + .mutate({ type: BookmarkTypes.TEXT, text }) .then((bookmark: ZBookmark) => { results.push(normalizeBookmark(bookmark)); }) @@ -87,7 +90,7 @@ bookmarkCmd const text = fs.readFileSync(0, "utf-8"); promises.push( api.bookmarks.createBookmark - .mutate({ type: "text", text }) + .mutate({ type: BookmarkTypes.TEXT, text }) .then((bookmark: ZBookmark) => { results.push(normalizeBookmark(bookmark)); }) |
