UNPKG

word-counter-tool-cli

Version:

A simple TypeScript console application to count the length of entered text in characters

25 lines (19 loc) 538 B
#! /usr/bin/env node import inquirer from "inquirer"; async function main() { try { const countWords = await inquirer.prompt<{ enterText: string }>([ { name: "enterText", type: "input", message: "Enter or paste your text:", }, ]); const words = countWords.enterText; console.log("Received text:", words); console.log(`The length of words is ${words.length} characters`); } catch (error) { console.log("An error aoccured:", error); } } main();