aingel
Version:
An interactive CLI tool with angel-themed greetings and blessings
193 lines (170 loc) • 5.82 kB
JavaScript
/**
* Angel NPM Package
* An interactive CLI tool with angel-themed greetings and blessings
*/
const chalk = require('chalk');
const figlet = require('figlet');
const gradient = require('gradient-string');
const inquirer = require('inquirer');
const { createSpinner } = require('nanospinner');
// Welcome screen
function welcome() {
console.clear();
const title = figlet.textSync('Angel', {
font: 'Standard',
horizontalLayout: 'default',
verticalLayout: 'default'
});
console.log(gradient.pastel.multiline(title));
console.log(`
${chalk.blue('✨ Welcome to Angel - Your Celestial Companion ✨')}
`);
}
// Get daily inspirational message based on date
function getDailyMessage() {
const date = new Date();
const day = date.getDate();
const messages = [
'Today is a perfect day for miracles',
'Your light shines brighter than you know',
'Divine timing is working in your favor',
'Angels are guiding your path today',
'You are surrounded by celestial protection',
'Trust the whispers of your heart',
'Heavenly blessings are flowing to you',
'Your guardian angel walks beside you',
'Miracles are unfolding in your life',
'Divine love surrounds you always',
'Your prayers are being answered',
'Celestial guidance is available to you',
'Angels celebrate your existence',
'You are divinely supported',
'Heavenly wisdom flows through you',
'Your path is illuminated by angels',
'Divine protection embraces you',
'Angelic assistance is yours today',
'Celestial light fills your being',
'Your angels are listening',
'Divine grace touches your life',
'Heavenly harmony surrounds you',
'Angels guide your decisions today',
'You are blessed beyond measure',
'Divine energy flows through you',
'Angelic whispers guide your intuition',
'Celestial joy fills your heart',
'Your angels celebrate your progress',
'Divine abundance flows to you',
'Heavenly peace embraces your soul',
'Angelic love surrounds you always'
];
return messages[day % messages.length];
}
// Display package information
function showPackageInfo() {
console.log(chalk.blue('\n📦 Package Information:\n'));
console.log(`${chalk.yellow('Name:')} Angel`);
console.log(`${chalk.yellow('Version:')} 1.0.0`);
console.log(`${chalk.yellow('Author:')} Maisy`);
console.log(`${chalk.yellow('License:')} ISC`);
console.log(`${chalk.yellow('Description:')} An interactive CLI tool with angel-themed greetings and blessings`);
}
// Virtual shop with magical items
function showShop() {
console.log(chalk.magenta('\n🌟 Celestial Shop Items:\n'));
const items = [
{ name: 'Angel Feather', price: '✨✨✨', description: 'Brings protection and guidance' },
{ name: 'Celestial Crystal', price: '✨✨✨✨', description: 'Amplifies spiritual connection' },
{ name: 'Divine Elixir', price: '✨✨✨✨✨', description: 'Restores energy and vitality' },
{ name: 'Harmony Pendant', price: '✨✨', description: 'Creates peace in your surroundings' },
{ name: 'Whisper Stone', price: '✨✨✨', description: 'Helps you hear angelic messages' }
];
items.forEach(item => {
console.log(`${chalk.cyan(item.name)} - ${chalk.yellow(item.price)}`);
console.log(` ${chalk.italic(item.description)}\n`);
});
}
/**
* Returns a greeting message from an angel
* @param {string} name - The name to greet
* @returns {string} - The greeting message
*/
function greet(name = 'friend') {
return `Hello ${name}, your guardian angel is watching over you!`;
}
/**
* Generates a random angel blessing
* @returns {string} - A random blessing
*/
function bless() {
const blessings = [
'May light guide your path',
'Wishing you peace and harmony',
'Divine protection surrounds you',
'Sending healing energy your way',
'May your day be filled with miracles'
];
return blessings[Math.floor(Math.random() * blessings.length)];
}
// Main menu function
async function mainMenu() {
const answer = await inquirer.prompt({
name: 'menu',
type: 'list',
message: 'What would you like to do?',
choices: [
'Receive a blessing',
'Get a personalized greeting',
'View daily message',
'Browse celestial shop',
'Package information',
'Exit'
]
});
switch(answer.menu) {
case 'Receive a blessing':
const spinner = createSpinner('Connecting to the celestial realm...').start();
setTimeout(() => {
spinner.success();
console.log(`\n${chalk.cyan('🌟 ' + bless())}\n`);
return mainMenu();
}, 1500);
break;
case 'Get a personalized greeting':
const nameAnswer = await inquirer.prompt({
name: 'username',
type: 'input',
message: 'What is your name?',
default: 'friend'
});
console.log(`\n${chalk.green(greet(nameAnswer.username))}\n`);
return mainMenu();
case 'View daily message':
console.log(`\n${chalk.yellow('✨ Daily Inspiration: ' + getDailyMessage())}\n`);
return mainMenu();
case 'Browse celestial shop':
showShop();
return mainMenu();
case 'Package information':
showPackageInfo();
return mainMenu();
case 'Exit':
console.log(chalk.blue('\nThank you for using Angel. May your path be blessed!\n'));
process.exit(0);
}
}
// Run the CLI application
function run() {
welcome();
console.log(chalk.yellow('✨ ' + getDailyMessage() + ' ✨\n'));
mainMenu();
}
// If this file is being run directly, start the CLI
if (require.main === module) {
run();
}
// Export functions for use as a library
module.exports = {
greet,
bless
};