This repository has been archived by the owner on Aug 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
52 lines (43 loc) · 1.38 KB
/
index.js
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
const inquirer = require('inquirer');
const process = require('process');
const main = require('./main');
const exportedOrSystemChoices = {
exported: 'Exported to current folder',
system: 'System < NOT SUPPORTED YET >'
}
async function Cli() {
try {
const { exportedOrSystem } = await inquirer.prompt({
type: 'list',
name: 'exportedOrSystem',
message: 'Do you want to translate locally exported file, or System one?',
choices: Object.values(exportedOrSystemChoices),
});
if(exportedOrSystem === exportedOrSystemChoices.system) {
console.log('===================');
console.log('THIS OPTION IS IN DEVELOPMENT')
console.log('===================');
process.exit(0);
} else if(exportedOrSystem === exportedOrSystemChoices.exported) {
const { fileName } = await inquirer.prompt({
type: 'input',
name: 'fileName',
message: 'Enter file name or hit Enter for default value (KeyboardShortcuts.xml)',
default() {
return 'KeyboardShortcuts.xml'
}
});
main(fileName);
}
} catch (error) {
if (error.isTtyError) {
console.error('CLI could not be rendered on your environment');
console.error(error.msg)
} else {
console.error('Something went wrong:');
console.error('=====================');
console.error(error)
}
}
}
Cli();