diff --git a/apps/cli/src/commands/bookmarks.ts b/apps/cli/src/commands/bookmarks.ts index 1537740b..60765c61 100644 --- a/apps/cli/src/commands/bookmarks.ts +++ b/apps/cli/src/commands/bookmarks.ts @@ -186,7 +186,8 @@ bookmarkCmd .command("update") .description("update a bookmark") .option("--title ", "if set, the bookmark's title will be updated") - .option("--note <note>", "if set, the bookmark's note will be updated") + .option("--note <note>", "if set, the bookmark's note will be updated (not to be used with --stdin)") + .option("--stdin", "if set, the bookmark's note will be updated by stdin (not to be used with --note)") .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") @@ -194,6 +195,18 @@ bookmarkCmd .argument("<id>", "the id of the bookmark to update") .action(async (id, opts) => { const api = getAPIClient(); + + if (opts.stdin) { + if (opts.note) { + printError( + `"--stdin" and "--note" cannot be used together` + ) + return + } + + opts.note = fs.readFileSync(0, "utf-8"); + } + await api.bookmarks.updateBookmark .mutate({ bookmarkId: id,