xref: /expo/packages/@expo/cli/src/whoami/index.ts (revision dfd15ebd)
1#!/usr/bin/env node
2import { Command } from '../../bin/cli';
3import { assertArgs, printHelp } from '../utils/args';
4import { logCmdError } from '../utils/errors';
5
6export const expoWhoami: Command = async (argv) => {
7  const args = assertArgs(
8    {
9      // Types
10      '--help': Boolean,
11      // Aliases
12      '-h': '--help',
13    },
14    argv
15  );
16
17  if (args['--help']) {
18    printHelp(
19      `Show the currently authenticated username`,
20      `npx expo whoami`,
21      `-h, --help    Usage info`
22    );
23  }
24
25  const { whoamiAsync } = await import('./whoamiAsync');
26  return whoamiAsync().catch(logCmdError);
27};
28