aboutsummaryrefslogtreecommitdiffstats
path: root/apps/cli/src/commands/whoami.ts
blob: 06a94e8ffc31aec8707269565a48a31e5006e176 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import { printError, printObject } from "@/lib/output";
import { getAPIClient } from "@/lib/trpc";
import { Command } from "@commander-js/extra-typings";

export const whoamiCmd = new Command()
  .name("whoami")
  .description("returns info about the owner of this API key")
  .action(async () => {
    await getAPIClient()
      .users.whoami.query()
      .then(printObject)
      .catch(
        printError(
          `Unable to fetch information about the owner of this API key`,
        ),
      );
  });