initial working menu system
This commit is contained in:
		
							parent
							
								
									b2b8bcbf85
								
							
						
					
					
						commit
						dcfc2abb39
					
				
							
								
								
									
										36
									
								
								app.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								app.js
									
									
									
									
									
										Normal 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
									
								
							
							
						
						
									
										12
									
								
								lib/files.js
									
									
									
									
									
										Normal 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
									
								
							
							
						
						
									
										16
									
								
								lib/inquirer.js
									
									
									
									
									
										Normal 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
									
								
							
							
						
						
									
										1357
									
								
								package-lock.json
									
									
									
										generated
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@ -2,7 +2,7 @@
 | 
				
			|||||||
  "name": "miwatchkleaner2.0",
 | 
					  "name": "miwatchkleaner2.0",
 | 
				
			||||||
  "version": "2.0.0",
 | 
					  "version": "2.0.0",
 | 
				
			||||||
  "description": "MiWatch Cleaning Tool",
 | 
					  "description": "MiWatch Cleaning Tool",
 | 
				
			||||||
  "main": "index.js",
 | 
					  "main": "app.js",
 | 
				
			||||||
  "scripts": {
 | 
					  "scripts": {
 | 
				
			||||||
    "test": "echo \"Error: no test specified\" && exit 1"
 | 
					    "test": "echo \"Error: no test specified\" && exit 1"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
@ -13,8 +13,14 @@
 | 
				
			|||||||
  "author": "Karl Hudgell",
 | 
					  "author": "Karl Hudgell",
 | 
				
			||||||
  "license": "ISC",
 | 
					  "license": "ISC",
 | 
				
			||||||
  "dependencies": {
 | 
					  "dependencies": {
 | 
				
			||||||
 | 
					    "chalk": "^4.0.0",
 | 
				
			||||||
 | 
					    "clear": "^0.1.0",
 | 
				
			||||||
 | 
					    "clui": "^0.3.6",
 | 
				
			||||||
    "download-file-with-progressbar": "^1.2.3",
 | 
					    "download-file-with-progressbar": "^1.2.3",
 | 
				
			||||||
 | 
					    "figlet": "^1.3.0",
 | 
				
			||||||
    "inquirer": "^7.1.0",
 | 
					    "inquirer": "^7.1.0",
 | 
				
			||||||
 | 
					    "lodash": "^4.17.15",
 | 
				
			||||||
 | 
					    "minimist": "^1.2.5",
 | 
				
			||||||
    "node-adb": "^0.1.6",
 | 
					    "node-adb": "^0.1.6",
 | 
				
			||||||
    "pkg": "^4.4.7"
 | 
					    "pkg": "^4.4.7"
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user