Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@clack/prompts

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@clack/prompts

Effortlessly build beautiful command-line apps 🪄 [Try the demo](https://stackblitz.com/edit/clack-prompts?file=index.js)

  • 0.7.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is @clack/prompts?

@clack/prompts is an npm package designed to facilitate the creation of interactive command-line prompts. It provides a variety of prompt types to gather user input in a streamlined and user-friendly manner.

What are @clack/prompts's main functionalities?

Text Prompt

This feature allows you to prompt the user for a text input. The example code asks the user for their name and then greets them.

const { text } = require('@clack/prompts');

(async () => {
  const name = await text({
    message: 'What is your name?'
  });
  console.log(`Hello, ${name}!`);
})();

Select Prompt

This feature allows you to present a list of options for the user to select from. The example code asks the user to choose a color from a list of options.

const { select } = require('@clack/prompts');

(async () => {
  const color = await select({
    message: 'Choose a color',
    choices: [
      { title: 'Red', value: 'red' },
      { title: 'Green', value: 'green' },
      { title: 'Blue', value: 'blue' }
    ]
  });
  console.log(`You chose ${color}.`);
})();

Confirm Prompt

This feature allows you to ask the user a yes/no question. The example code asks the user if they want to continue and logs a message based on their response.

const { confirm } = require('@clack/prompts');

(async () => {
  const proceed = await confirm({
    message: 'Do you want to continue?'
  });
  console.log(proceed ? 'Continuing...' : 'Operation aborted.');
})();

Password Prompt

This feature allows you to securely prompt the user for a password. The example code asks the user to enter their password and logs a confirmation message.

const { password } = require('@clack/prompts');

(async () => {
  const secret = await password({
    message: 'Enter your password:'
  });
  console.log('Password received.');
})();

Other packages similar to @clack/prompts

Keywords

FAQs

Package last updated on 09 Aug 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc