{"library":"promptly","title":"Promptly CLI Utility","description":"Promptly is a focused Node.js utility for handling command-line input and user interaction. Currently stable at version 3.2.0, it provides a robust `prompt` function with extensive options for input validation, default values, silent input (e.g., for passwords), character replacement, and custom input/output streams. It supports retry logic for failed validations by default and offers timeout functionality. While the release cadence isn't explicitly stated in the provided documentation, its stable 3.x version and continued maintenance on GitHub suggest a steady, albeit perhaps slower, evolution. Its key differentiators lie in its comprehensive validation system with custom error messages and automatic retries, as well as fine-grained control over I/O streams and timeouts, making it suitable for building interactive CLI tools where user input quality is critical. It is primarily used in Node.js environments for CLI applications.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install promptly"],"cli":null},"imports":["const promptly = require('promptly');","const { prompt } = require('promptly');","(async () => { const name = await promptly.prompt('Name: '); console.log(name); })();"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"const promptly = require('promptly');\n\nconst validator = function (value) {\n    if (value.length < 2) {\n        throw new Error('Min length of 2');\n    }\n\n    return value;\n};\n\n(async () => {\n    try {\n        console.log('Please enter your name. It must be at least 2 characters long.');\n        // Since retry is true by default, promptly will keep asking for a name until it is valid\n        // Between each prompt, the error message from the validator will be printed\n        const name = await promptly.prompt('Your Name: ', { validator });\n        console.log(`Hello, ${name}!`);\n\n        // Example with silent input (for password)\n        const password = await promptly.prompt('Enter password (will not show): ', { silent: true, replace: '*' });\n        console.log('Password length:', password.length);\n\n    } catch (err) {\n        console.error('An error occurred:', err.message);\n    }\n})();","lang":"javascript","description":"This quickstart demonstrates basic prompting, input validation with custom error messages, and silent input for sensitive information like passwords, utilizing async/await for clarity.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}