1.1.4 • Published 11 months ago

@lexjs/prompts v1.1.4

Weekly downloads
-
License
ISC
Repository
github
Last release
11 months ago

@lexjs/prompts

Build NPM Version

Interactive prompts

Installation

npm install @lexjs/prompts
pnpm add @lexjs/prompts
yarn add @lexjs/prompts

Methods

autocomplete

import $_ from '@lexjs/prompts';

const result = await $_.autocomplete({
  message: 'Choose a city',
  name: 'city',
  choices: [
    { title: 'New York City' },
    { title: 'Toronto' },
    { title: 'London' },
    { title: 'Paris' },
  ],
});

autocompleteMultiselect

import $_ from '@lexjs/prompts';

const result = await $_.autocompleteMultiselect({
  message: 'Pick colors',
  name: 'colors',
  choices: [
    { title: 'Red', value: '#ff0000' },
    { title: 'Green', value: '#008000' },
    { title: 'Blue', value: '#0000ff' },
    { title: 'White', value: '#ffffff' },
    { title: 'Black', value: '#000000' },
  ],
  instructions: false,
});

confirm

import $_ from '@lexjs/prompts';

const result = await $_.confirm({
  message: 'Confirm?',
  name: 'value',
});

date

import $_ from '@lexjs/prompts';

const result = await $_.date({
  message: 'Enter a date',
  name: 'date',
});

invisible

import $_ from '@lexjs/prompts';

const result = await $_.invisible({
  message: 'Enter password',
  name: 'password',
});

list

import $_ from '@lexjs/prompts';

const result = await $_.list({
  message: 'Enter values',
  name: 'values',
  separator: ' ',
});

multiselect

import $_ from '@lexjs/prompts';

const result = await $_.multiselect({
  message: 'Pick colors',
  name: 'colors',
  choices: [
    { title: 'Red', value: '#ff0000' },
    { title: 'Green', value: '#008000' },
    { title: 'Blue', value: '#0000ff' },
    { title: 'White', value: '#ffffff' },
    { title: 'Black', value: '#000000' },
  ],
  instructions: false,
});

number

import $_ from '@lexjs/prompts';

const result = await $_.number({
  message: 'Enter a number between 10 and 100',
  name: 'number',
  min: 10,
  max: 100,
  initial: 0,
});

password

import $_ from '@lexjs/prompts';

const result = await $_.password({
  message: 'Enter password',
  name: 'password',
});

select

import $_ from '@lexjs/prompts';

const result = await $_.select({
  message: 'Pick a color',
  name: 'color',
  choices: [
    { title: 'Red', value: '#ff0000' },
    { title: 'Green', value: '#008000' },
    { title: 'Blue', value: '#0000ff' },
    { title: 'White', value: '#ffffff' },
    { title: 'Black', value: '#000000' },
  ],
});

text

import $_ from '@lexjs/prompts';

const result = await $_.text({
  message: 'What is your name?',
  name: 'value',
});

toggle

import $_ from '@lexjs/prompts';

const result = await $_.toggle({
  message: 'Confirm?',
  name: 'value',
});

Credits

This library is a wrapper around the prompts package.

1.1.1

11 months ago

1.1.0

11 months ago

1.0.0

12 months ago

1.1.4

11 months ago

1.1.3

11 months ago

1.1.2

11 months ago

0.0.1

1 year ago

0.0.1-beta.6

1 year ago

0.0.1-beta.5

1 year ago

0.0.1-beta.4

1 year ago

0.0.1-beta.3

1 year ago

0.0.1-beta.2

1 year ago

0.0.1-beta.1

1 year ago