-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathinteractive.ts
More file actions
52 lines (47 loc) · 1.28 KB
/
interactive.ts
File metadata and controls
52 lines (47 loc) · 1.28 KB
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
52
import { cliux } from '@contentstack/cli-utilities';
export const askPassword = async () => {
return cliux.inquire<string>({
type: 'input',
message: 'CLI_AUTH_LOGIN_ENTER_PASSWORD',
name: 'password',
transformer: (pswd: string) => {
return '*'.repeat(pswd.length);
},
});
};
export const askOTPChannel = async (): Promise<string> => {
return cliux.inquire<string>({
type: 'list',
name: 'otpChannel',
message: 'CLI_AUTH_LOGIN_ASK_CHANNEL_FOR_OTP',
choices: [
{ name: 'Authenticator App', value: 'authenticator_app' },
{ name: 'SMS', value: 'sms' },
],
});
};
export const askOTP = async (): Promise<string> => {
return cliux.inquire({
type: 'input',
message: 'CLI_AUTH_LOGIN_ENTER_SECURITY_CODE',
name: 'tfaToken',
});
};
export const askUsername = async (): Promise<string> => {
return cliux.inquire<string>({
type: 'input',
message: 'CLI_AUTH_LOGIN_ENTER_EMAIL_ADDRESS',
name: 'username',
});
};
export const askTokenType = async (): Promise<string> => {
return cliux.inquire<string>({
type: 'list',
name: 'tokenType',
message: 'CLI_SELECT_TOKEN_TYPE',
choices: [
{ name: 'Management Token', value: 'management' },
{ name: 'Delivery Token', value: 'delivery' },
],
});
};