From cde97267a90802c6a367aa61ff157983506deead Mon Sep 17 00:00:00 2001 From: kamtschatka Date: Sun, 9 Jun 2024 23:30:24 +0200 Subject: fix(cli): Bookmark list output is not a valid JSON. Fixes #150 (#181) * bookmark list output is not a valid JSON #150 Reworked the cli to switch over to json output * changed the logging to log created bookmarks as an array switch all log output that is just a status to stderr --------- Co-authored-by: kamtschatka --- apps/cli/src/commands/whoami.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'apps/cli/src/commands/whoami.ts') diff --git a/apps/cli/src/commands/whoami.ts b/apps/cli/src/commands/whoami.ts index b55bfa67..06a94e8f 100644 --- a/apps/cli/src/commands/whoami.ts +++ b/apps/cli/src/commands/whoami.ts @@ -1,3 +1,4 @@ +import { printError, printObject } from "@/lib/output"; import { getAPIClient } from "@/lib/trpc"; import { Command } from "@commander-js/extra-typings"; @@ -5,6 +6,12 @@ export const whoamiCmd = new Command() .name("whoami") .description("returns info about the owner of this API key") .action(async () => { - const resp = await getAPIClient().users.whoami.query(); - console.log(resp); + await getAPIClient() + .users.whoami.query() + .then(printObject) + .catch( + printError( + `Unable to fetch information about the owner of this API key`, + ), + ); }); -- cgit v1.2.3-70-g09d2