| 113 | } |
| 114 | |
| 115 | private async promptPassword(password: string | boolean) { |
| 116 | // boolean => flag set with no value, we need to prompt for password |
| 117 | // string => flag set with value, use this value for password |
| 118 | // undefined/null/false => account protect, not password, no password needed |
| 119 | if (typeof password === "string") { |
| 120 | return password; |
| 121 | } else if (password) { |
| 122 | const answer: inquirer.Answers = await inquirer.createPromptModule({ |
| 123 | output: process.stderr, |
| 124 | })({ |
| 125 | type: "password", |
| 126 | name: "password", |
| 127 | message: "Export file password:", |
| 128 | }); |
| 129 | return answer.password as string; |
| 130 | } |
| 131 | return null; |
| 132 | } |
| 133 | |
| 134 | private isSupportedExportFormat(format: string): format is ExportFormat { |
| 135 | return EXPORT_FORMATS.includes(format as ExportFormat); |