xutilities-cli
Version:
A Command-Line Interface Tool For xUtilities (An Unblocked Games, Apps, & More Website Used When Bored At Work Or School) Used In-Case xUtilities On The Web Is Blocked/Banned.
37 lines (32 loc) • 1.1 kB
JavaScript
import inquirer from 'inquirer';
import open from 'open';
import chalk from 'chalk';
// List of links
const links = [
{ name: 'Coming soon.', url: 'about:blank' },
];
export const showLinks = async () => {
console.clear(); // Clear the terminal before showing the links menu
console.log(chalk.green.bold('\nWelcome to xUtilities Links! Here are alternative links to xUtilities in case one gets blocked\n'));
const { selectedLink } = await inquirer.prompt([
{
type: 'list',
name: 'selectedLink',
message: 'Choose a link to open:',
choices: [
...links.map((link) => ({
name: link.name,
value: link.url,
})),
{ name: '\nBACK\n', value: 'back' }, // Add a "Back" option
],
},
]);
if (selectedLink === 'back') {
console.clear(); // Clear the terminal before returning to the main menu
return; // Exit the function to return to the main menu
}
// Open the selected link in the browser
console.log(chalk.blue(`Continue to ${selectedLink} on your web browser...`));
await open(selectedLink);
};