inquirer.js 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. const inquirer = require("inquirer");
  2. const files = require("./files");
  3. const common = require("./common");
  4. // let compatibleApps
  5. module.exports = {
  6. mainMenu: () => {
  7. const questions = [{
  8. type: "list",
  9. name: "mainMenu",
  10. message: "What do you want to do?",
  11. choices: [
  12. // "Connect to MiWatch",
  13. "1-Click Karl0ss Klean",
  14. "Remove Xiaomi Apps",
  15. "Restore Xiaomi Apps",
  16. "Install Compatible Apps",
  17. "Restore ANY app",
  18. "Batch Install APKs",
  19. "Batch Remove Installed Apps",
  20. "Quit"
  21. ],
  22. filter: function (val) {
  23. return val.toLowerCase();
  24. },
  25. }, ];
  26. return inquirer.prompt(questions);
  27. },
  28. connectionType: () => {
  29. const questions = [{
  30. type: "list",
  31. name: "connection",
  32. message: "How do you want to connect?",
  33. choices: [
  34. "USB",
  35. "Wifi"
  36. ],
  37. filter: function (val) {
  38. return val.toLowerCase();
  39. },
  40. }, ];
  41. return inquirer.prompt(questions);
  42. },
  43. connectWifi: () => {
  44. const questions = [{
  45. type: "input",
  46. name: "connectWifi",
  47. message: "What is your MiWatch IpAdress?",
  48. }, ];
  49. return inquirer.prompt(questions);
  50. },
  51. removeAppsList: async () => {
  52. const packages = await files.loadPackageList();
  53. const questions = [{
  54. type: "checkbox",
  55. name: "removeAppsList",
  56. message: "What apps do you want to restore?",
  57. choices: packages.apps,
  58. }, ];
  59. return inquirer.prompt(questions);
  60. },
  61. compatibleApps: async () => {
  62. const compatibleApps = await common.getCompatibleAppsList()
  63. const appList = []
  64. for (let element of compatibleApps) {
  65. appList.push(element.name)
  66. }
  67. const questions = [{
  68. type: "checkbox",
  69. name: "removeAppsList",
  70. message: "What apps do you want to Install?",
  71. choices: appList,
  72. }, ];
  73. return inquirer.prompt(questions);
  74. },
  75. installedApps: async (installedApps) => {
  76. const questions = [{
  77. type: "checkbox",
  78. name: "removeAppsList",
  79. message: "What Installed apps do you want to remove?",
  80. choices: installedApps,
  81. }, ];
  82. return inquirer.prompt(questions);
  83. },
  84. restoreAnyApp: async () => {
  85. const questions = [{
  86. type: "input",
  87. name: "restoreAnyApp",
  88. message: "What App do you want to restore?",
  89. }, ];
  90. return inquirer.prompt(questions);
  91. },
  92. };