inquirer.js 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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 via Wifi",
  13. "1-Click Karl0ss Klean",
  14. "Remove Xiaomi Apps",
  15. "Restore Xiaomi Apps",
  16. "Install Compatible Apps",
  17. "Remove Installed Apps",
  18. "Restore ANY app",
  19. "Quit"
  20. ],
  21. filter: function (val) {
  22. return val.toLowerCase();
  23. },
  24. }, ];
  25. return inquirer.prompt(questions);
  26. },
  27. connectWifi: () => {
  28. const questions = [{
  29. type: "input",
  30. name: "connectWifi",
  31. message: "What is your MiWatch IpAdress?",
  32. }, ];
  33. return inquirer.prompt(questions);
  34. },
  35. removeAppsList: async () => {
  36. const packages = await files.loadPackageList();
  37. const questions = [{
  38. type: "checkbox",
  39. name: "removeAppsList",
  40. message: "What apps do you want to restore?",
  41. choices: packages.apps,
  42. }, ];
  43. return inquirer.prompt(questions);
  44. },
  45. compatibleApps: async () => {
  46. const compatibleApps = await common.getCompatibleAppsList()
  47. const appList = []
  48. for (let element of compatibleApps) {
  49. appList.push(element.name)
  50. }
  51. const questions = [{
  52. type: "checkbox",
  53. name: "removeAppsList",
  54. message: "What apps do you want to Install?",
  55. choices: appList,
  56. }, ];
  57. return inquirer.prompt(questions);
  58. },
  59. installedApps: async (installedApps) => {
  60. const questions = [{
  61. type: "checkbox",
  62. name: "removeAppsList",
  63. message: "What Installed apps do you want to remove?",
  64. choices: installedApps,
  65. }, ];
  66. return inquirer.prompt(questions);
  67. },
  68. restoreAnyApp: async () => {
  69. const questions = [{
  70. type: "input",
  71. name: "restoreAnyApp",
  72. message: "What App do you want to restore?",
  73. }, ];
  74. return inquirer.prompt(questions);
  75. },
  76. };