-
Notifications
You must be signed in to change notification settings - Fork 4.7k
/
index.ts
51 lines (45 loc) · 1.15 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env node
import chalk from 'chalk';
import { Command } from '../../bin/cli';
import * as Log from '../log';
import { assertArgs } from '../utils/args';
import { logCmdError } from '../utils/errors';
export const expoLogin: Command = async (argv) => {
const args = assertArgs(
{
// Types
'--help': Boolean,
'--username': String,
'--password': String,
'--otp': String,
// Aliases
'-h': '--help',
'-u': '--username',
'-p': '--password',
},
argv
);
if (args['--help']) {
Log.exit(
chalk`
{bold Description}
Log in to an Expo account
{bold Usage}
$ npx expo login
Options
-u, --username <string> Username
-p, --password <string> Password
--otp <string> One-time password from your 2FA device
-h, --help Output usage information
`,
0
);
}
const { showLoginPromptAsync } = await import('../utils/user/actions');
return showLoginPromptAsync({
// Parsed options
username: args['--username'],
password: args['--password'],
otp: args['--otp'],
}).catch(logCmdError);
};