2023-02-26 15:16:21 -05:00
|
|
|
import chalk from "chalk";
|
2023-03-17 21:33:34 -04:00
|
|
|
import readline from 'readline'
|
2023-02-26 15:16:21 -05:00
|
|
|
|
2023-03-17 21:33:34 -04:00
|
|
|
export function generateQuery(context) {
|
2023-02-26 15:16:21 -05:00
|
|
|
var query;
|
|
|
|
|
if (context == "animeep") {
|
|
|
|
|
query = "To dump all data enter ";
|
|
|
|
|
query += chalk.red("dumpdata");
|
|
|
|
|
query += `\nTo get the anime description enter ${chalk.green("desc")}`;
|
|
|
|
|
query += "\nTo dump episode data enter ";
|
|
|
|
|
query += chalk.yellow("episodes-all");
|
|
|
|
|
query += ", therwise, enter the " + chalk.yellow("episode number\n");
|
|
|
|
|
query += chalk.italic("Note: to compile with an episode number use");
|
2023-02-26 19:14:52 -05:00
|
|
|
query += chalk.blueBright(" --anime name=name episode=#\n");
|
2023-02-26 15:16:21 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return query;
|
2023-03-17 21:33:34 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param {String} query
|
|
|
|
|
* @returns {Promise<String>}
|
|
|
|
|
*/
|
|
|
|
|
export function askUserQuery(query) {
|
|
|
|
|
const rl = readline.createInterface({
|
|
|
|
|
input: process.stdin,
|
|
|
|
|
output: process.stdout,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return new Promise(resolve => rl.question(query, ans => {
|
|
|
|
|
rl.close();
|
|
|
|
|
resolve(ans);
|
|
|
|
|
}))
|
|
|
|
|
|
2023-02-26 15:16:21 -05:00
|
|
|
}
|