initial working menu system

This commit is contained in:
karl.hudgell 2020-04-24 20:42:45 +01:00
parent b2b8bcbf85
commit dcfc2abb39
5 changed files with 1428 additions and 1 deletions

36
app.js Normal file
View File

@ -0,0 +1,36 @@
const chalk = require('chalk');
const clear = require('clear');
const figlet = require('figlet');
const files = require('./lib/files');
const inquirer = require('./lib/inquirer');
clear();
console.log(
chalk.red(
figlet.textSync('MiWatch Kleaner', {
horizontalLayout: 'full'
})
)
);
console.log(chalk.red('2.0.0'));
console.log(
chalk.red(
'-------------------------------------------------------------------------------------------------------'
)
)
const run = async () => {
const mainMenuSelection = await inquirer.mainMenu();
console.log(mainMenuSelection);
};
run();
// if (files.directoryExists('.git')) {
// console.log(chalk.red('Already a Git repository!'));
// process.exit();
// }

12
lib/files.js Normal file
View File

@ -0,0 +1,12 @@
const fs = require('fs');
const path = require('path');
module.exports = {
getCurrentDirectoryBase: () => {
return path.basename(process.cwd());
},
directoryExists: (filePath) => {
return fs.existsSync(filePath);
}
};

16
lib/inquirer.js Normal file
View File

@ -0,0 +1,16 @@
const inquirer = require('inquirer');
module.exports = {
mainMenu: () => {
const questions = [{
type: 'list',
name: 'mainMenu',
message: 'What do you want to do?',
choices: ['Connect to MiWatch via Wifi', 'Remove Install Xiaomi Apps', 'Install Compatible Apps', 'Restore Uninstalled Apps'],
filter: function (val) {
return val.toLowerCase();
}
}];
return inquirer.prompt(questions);
},
};

1357
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
"name": "miwatchkleaner2.0",
"version": "2.0.0",
"description": "MiWatch Cleaning Tool",
"main": "index.js",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
@ -13,8 +13,14 @@
"author": "Karl Hudgell",
"license": "ISC",
"dependencies": {
"chalk": "^4.0.0",
"clear": "^0.1.0",
"clui": "^0.3.6",
"download-file-with-progressbar": "^1.2.3",
"figlet": "^1.3.0",
"inquirer": "^7.1.0",
"lodash": "^4.17.15",
"minimist": "^1.2.5",
"node-adb": "^0.1.6",
"pkg": "^4.4.7"
}