Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Generated on May 18, 2024 via pnpm

prompts 2.4.2

Lightweight, beautiful and user-friendly prompts
Package summary
Share
0
issues
1
license
3
MIT
Package created
18 Feb 2018
Version published
7 Oct 2021
Maintainers
1
Total deps
3
Direct deps
2
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
3 Packages, Including:
kleur@3.0.3
prompts@2.4.2
sisteransi@1.0.5
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

2
All Dependencies CSV
β“˜ This is a list of prompts 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
kleur3.0.34.19 kBMIT
prod
sisteransi1.0.52.54 kBMIT
prod

Visualizations

Frequently Asked Questions

What does prompts do?

Prompts is a lightweight, user-friendly, and attractive NPM package that provides interactive command line interfaces. Specific features that make Prompts stand out include its use of promises and async/await functionality, eliminating callback clutter. Each prompt type is independent and can be used separately. Their interfaces leverage layout and colors to create a beautiful CLI experience.

How do you use prompts?

To use prompts, you'll first need to install the NPM package in your project using the command npm install --save prompts. After this, you can import it into your JavaScript file with const prompts = require('prompts');

There are multiple ways to use prompts, depending on the interaction you want with the user. Here are a few examples:

For a single text prompt usage:

const prompts = require('prompts');

(async () => {
  const response = await prompts({
    type: 'text',
    name: 'meaning',
    message: 'What is the meaning of life?'
});

console.log(response.meaning);
})();

For multiple questions, you can chain the prompts together:

const prompts = require('prompts');

const questions = [
  {
    type: 'text',
    name: 'username',
    message: 'What is your GitHub username?'
  },
  {
    type: 'number',
    name: 'age',
    message: 'How old are you?'
  },
  {
    type: 'text',
    name: 'about',
    message: 'Tell something about yourself',
    initial: 'Why should I?'
  }
];

(async () => {
  const response = await prompts(questions);

  // => response => { username, age, about }
})();

Dynamic prompts, where the property values can be functions are also supported:

const prompts = require('prompts');

const questions = [
  {
    type: 'text',
    name: 'dish',
    message: 'Do you like pizza?'
  },
  {
    type: prev => prev == 'pizza' ? 'text' : null,
    name: 'topping',
    message: 'Name a topping'
  }
];

(async () => {
  const response = await prompts(questions);
})();

Where are the prompts docs?

The Prompts documentation can be found directly in its README file on its GitHub page, at the URL https://github.com/terkelg/prompts. The README contains detailed information on how to install and use Prompts, examples of its usage, API details, and more.