Adfaft

CLI

Readline to ask input via command line

const readline = require('node:readline');

const rl = readline.createInterface({
	input: process.stdin,
	output: process.stdout,
});

function ask(question:string): Promise<string> {
	return new Promise((resolve, reject) => {
		rl.question(question, (input:string) => resolve(input))
	});

}

(async() => {
	let totalBudget = Number(await ask("Total Budget in a month? "))
	let totalDays = Number(await ask("How many days in a month? "))
	
	budgetPerDay = Number(totalBudget) / totalDays

	console.log(`Budget for ${rp(totalBudget)} will have a daily budget of ${rp(budgetPerDay)} !`)

})()