{"name":"@inquirer/prompts","version":"3.3.0","keywords":["answer","answers","ask","base","cli","command","command-line","confirm","enquirer","generate","generator","hyper","input","inquire","inquirer","interface","iterm","javascript","menu","node","nodejs","prompt","promptly","prompts","question","readline","scaffold","scaffolder","scaffolding","stdin","stdout","terminal","tty","ui","yeoman","yo","zsh","types","typescript"],"author":{"name":"Simon Boudrias","email":"admin@simonboudrias.com"},"license":"MIT","_id":"@inquirer/prompts@3.3.0","maintainers":[{"name":"sboudrias","email":"admin@simonboudrias.com"},{"name":"danielchatfield","email":"chatfielddaniel@gmail.com"},{"name":"mischah","email":"mail@michael-kuehnel.de"}],"homepage":"https://github.com/SBoudrias/Inquirer.js/blob/master/packages/prompts/README.md","bugs":{"url":"https://github.com/SBoudrias/Inquirer.js/issues"},"dist":{"shasum":"1324881d207e37b1162f174fb9726b9ecb4c475c","tarball":"http://registry-npm.ywwl.com/@inquirer/prompts/download/@inquirer/prompts-3.3.0.tgz","fileCount":8,"integrity":"sha512-BBCqdSnhNs+WziSIo4f/RNDu6HAj4R/Q5nMgJb5MNPFX8sJGCvj9BoALdmR0HTWXyDS7TO8euKj6W6vtqCQG7A==","signatures":[{"sig":"MEUCIQDdE+aqNrXGm7bMRxtMGWA+tedJXDsTVncnR6y0GSdp6gIgXCHqIC/+WFnlfDDlwwFFmoRnPRiUMHMD2T1bSkbvFw0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":17411,"size":5035,"noattachment":false,"key":"/@inquirer/prompts/-/@inquirer/prompts-3.3.0.tgz"},"main":"./dist/cjs/index.js","engines":{"node":">=14.18.0"},"exports":{".":{"import":{"types":"./dist/esm/types/index.d.mts","default":"./dist/esm/index.mjs"},"require":{"types":"./dist/cjs/types/index.d.ts","default":"./dist/cjs/index.js"}}},"gitHead":"a318aec57d33b53131c0b03cc8dd6ab4efae3e50","scripts":{"tsc":"yarn run tsc:esm && yarn run tsc:cjs","tsc:cjs":"rm -rf dist/cjs && tsc -p ./tsconfig.cjs.json && node ../../tools/fix-ext.mjs","tsc:esm":"rm -rf dist/esm && tsc -p ./tsconfig.json"},"typings":"./dist/cjs/types/index.d.ts","_npmUser":{"name":"sboudrias","email":"admin@simonboudrias.com"},"repository":{"url":"git+https://github.com/SBoudrias/Inquirer.js.git","type":"git"},"_npmVersion":"lerna/7.4.2/node@v20.8.0+arm64 (darwin)","description":"Inquirer prompts, combined in a single package","directories":{},"_nodeVersion":"20.8.0","dependencies":{"@inquirer/core":"^5.1.1","@inquirer/input":"^1.2.14","@inquirer/editor":"^1.2.13","@inquirer/expand":"^1.1.14","@inquirer/select":"^1.3.1","@inquirer/confirm":"^2.0.15","@inquirer/rawlist":"^1.2.14","@inquirer/checkbox":"^1.5.0","@inquirer/password":"^1.1.14"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/prompts_3.3.0_1699395770611_0.05227929409543264","host":"s3://npm-registry-packages"},"readme":"<img width=\"75px\" height=\"75px\" align=\"right\" alt=\"Inquirer Logo\" src=\"https://raw.githubusercontent.com/SBoudrias/Inquirer.js/master/assets/inquirer_readme.svg?sanitize=true\" title=\"Inquirer.js\"/>\n\n# Inquirer\n\n[![npm](https://badge.fury.io/js/@inquirer%2Fprompts.svg)](https://www.npmjs.com/package/@inquirer/prompts)\n[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2FSBoudrias%2FInquirer.js.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2FSBoudrias%2FInquirer.js?ref=badge_shield)\n\nA collection of common interactive command line user interfaces.\n\n![List prompt](https://cdn.rawgit.com/SBoudrias/Inquirer.js/28ae8337ba51d93e359ef4f7ee24e79b69898962/assets/screenshots/list.svg)\n\nGive it a try in your own terminal!\n\n```sh\nnpx @inquirer/demo@latest\n```\n\n# Installation\n\n```sh\nnpm install @inquirer/prompts\n\nyarn add @inquirer/prompts\n```\n\nInquirer recently underwent a rewrite from the ground up to reduce the package size and improve performance. The previous version of the package is still maintained (though not actively developed), and offered hundreds of community contributed prompts that might not have been migrated to the latest API. If this is what you're looking for, the [previous package is over here](https://github.com/SBoudrias/Inquirer.js/tree/master/packages/inquirer).\n\n# Usage\n\n```js\nimport { input } from '@inquirer/prompts';\n\nconst answer = await input({ message: 'Enter your name' });\n```\n\n# Prompts\n\n## [Input](https://github.com/SBoudrias/Inquirer.js/tree/master/packages/input)\n\n![Input prompt](https://cdn.rawgit.com/SBoudrias/Inquirer.js/28ae8337ba51d93e359ef4f7ee24e79b69898962/assets/screenshots/input.svg)\n\n```js\nimport { input } from '@inquirer/prompts';\n```\n\n[See documentation](https://github.com/SBoudrias/Inquirer.js/tree/master/packages/input) for usage example and options documentation.\n\n## [Select](https://github.com/SBoudrias/Inquirer.js/tree/master/packages/select)\n\n![Select prompt](https://cdn.rawgit.com/SBoudrias/Inquirer.js/28ae8337ba51d93e359ef4f7ee24e79b69898962/assets/screenshots/list.svg)\n\n```js\nimport { select } from '@inquirer/prompts';\n```\n\n[See documentation](https://github.com/SBoudrias/Inquirer.js/tree/master/packages/select) for usage example and options documentation.\n\n## [Checkbox](https://github.com/SBoudrias/Inquirer.js/tree/master/packages/checkbox)\n\n![Checkbox prompt](https://cdn.rawgit.com/SBoudrias/Inquirer.js/28ae8337ba51d93e359ef4f7ee24e79b69898962/assets/screenshots/checkbox.svg)\n\n```js\nimport { checkbox } from '@inquirer/prompts';\n```\n\n[See documentation](https://github.com/SBoudrias/Inquirer.js/tree/master/packages/checkbox) for usage example and options documentation.\n\n## [Confirm](https://github.com/SBoudrias/Inquirer.js/tree/master/packages/confirm)\n\n![Confirm prompt](https://cdn.rawgit.com/SBoudrias/Inquirer.js/28ae8337ba51d93e359ef4f7ee24e79b69898962/assets/screenshots/confirm.svg)\n\n```js\nimport { confirm } from '@inquirer/prompts';\n```\n\n[See documentation](https://github.com/SBoudrias/Inquirer.js/tree/master/packages/confirm) for usage example and options documentation.\n\n## [Password](https://github.com/SBoudrias/Inquirer.js/tree/master/packages/password)\n\n![Password prompt](https://cdn.rawgit.com/SBoudrias/Inquirer.js/28ae8337ba51d93e359ef4f7ee24e79b69898962/assets/screenshots/password.svg)\n\n```js\nimport { password } from '@inquirer/prompts';\n```\n\n[See documentation](https://github.com/SBoudrias/Inquirer.js/tree/master/packages/password) for usage example and options documentation.\n\n## [Expand](https://github.com/SBoudrias/Inquirer.js/tree/master/packages/expand)\n\n![Expand prompt closed](https://cdn.rawgit.com/SBoudrias/Inquirer.js/28ae8337ba51d93e359ef4f7ee24e79b69898962/assets/screenshots/expand-y.svg)\n![Expand prompt expanded](https://cdn.rawgit.com/SBoudrias/Inquirer.js/28ae8337ba51d93e359ef4f7ee24e79b69898962/assets/screenshots/expand-d.svg)\n\n```js\nimport { expand } from '@inquirer/prompts';\n```\n\n[See documentation](https://github.com/SBoudrias/Inquirer.js/tree/master/packages/expand) for usage example and options documentation.\n\n## [Editor](https://github.com/SBoudrias/Inquirer.js/tree/master/packages/editor)\n\nLaunches an instance of the users preferred editor on a temporary file. Once the user exits their editor, the content of the temporary file is read as the answer. The editor used is determined by reading the $VISUAL or $EDITOR environment variables. If neither of those are present, the OS default is used (notepad on Windows, vim on Mac or Linux.)\n\n```js\nimport { editor } from '@inquirer/prompts';\n```\n\n[See documentation](https://github.com/SBoudrias/Inquirer.js/tree/master/packages/editor) for usage example and options documentation.\n\n## [Raw List](https://github.com/SBoudrias/Inquirer.js/tree/master/packages/rawlist)\n\n![Raw list prompt](https://cdn.rawgit.com/SBoudrias/Inquirer.js/28ae8337ba51d93e359ef4f7ee24e79b69898962/assets/screenshots/rawlist.svg)\n\n```js\nimport { rawlist } from '@inquirer/prompts';\n```\n\n[See documentation](https://github.com/SBoudrias/Inquirer.js/tree/master/packages/rawlist) for usage example and options documentation.\n\n# Create your own prompts\n\nThe [API documentation is over here](https://github.com/SBoudrias/Inquirer.js/tree/master/packages/core), and our [testing utilities here](https://github.com/SBoudrias/Inquirer.js/tree/master/packages/testing).\n\n# Advanced usage\n\nAll inquirer prompts are a function taking 2 arguments. The first argument is the prompt configuration (unique to each prompt). The second is providing contextual or runtime configuration.\n\nThe context options are:\n\n| Property          | Type                    | Required | Description                                                  |\n| ----------------- | ----------------------- | -------- | ------------------------------------------------------------ |\n| input             | `NodeJS.ReadableStream` | no       | The stdin stream (defaults to `process.stdin`)               |\n| output            | `NodeJS.WritableStream` | no       | The stdout stream (defaults to `process.stdout`)             |\n| clearPromptOnDone | `boolean`               | no       | If true, we'll clear the screen after the prompt is answered |\n\nExample:\n\n```js\nimport { confirm } from '@inquirer/prompts';\n\nconst allowEmail = await confirm(\n  { message: 'Do you allow us to send you email?' },\n  {\n    output: new Stream.Writable({\n      write(chunk, _encoding, next) {\n        // Do something\n        next();\n      },\n    }),\n    clearPromptOnDone: true,\n  },\n);\n```\n\n## Canceling prompt\n\nAll prompt functions are returning a cancelable promise. This special promise type has a `cancel` method that'll cancel and cleanup the prompt.\n\nOn calling `cancel`, the answer promise will become rejected.\n\n```js\nimport { confirm } from '@inquirer/prompts';\n\nconst answer = confirm(...); // note: for this you cannot use `await`\n\nanswer.cancel();\n```\n\n# Recipes\n\n## Get answers in an object\n\nWhen asking many questions, you might not want to keep one variable per answer everywhere. In which case, you can put the answer inside an object.\n\n```js\nimport { input, confirm } from '@inquirer/prompts';\n\nconst answers = {\n  firstName: await input({ message: \"What's your first name?\" }),\n  allowEmail: await confirm({ message: 'Do you allow us to send you email?' }),\n};\n\nconsole.log(answers.firstName);\n```\n\n## Ask a question conditionally\n\nMaybe some questions depend on some other question's answer.\n\n```js\nimport { input, confirm } from '@inquirer/prompts';\n\nconst allowEmail = await confirm({ message: 'Do you allow us to send you email?' });\n\nlet email;\nif (allowEmail) {\n  email = await input({ message: 'What is your email address' });\n}\n```\n\n## Get default value after timeout\n\n```js\nimport { setTimeout } from 'node:timers/promises';\nimport { input } from '@inquirer/prompts';\n\nconst ac = new AbortController();\nconst prompt = input({\n  message: 'Enter a value (timing out in 5 seconds)',\n});\n\nprompt\n  .finally(() => {\n    ac.abort();\n  })\n  // Silencing the cancellation error.\n  .catch(() => {});\n\nconst defaultValue = setTimeout(5000, 'timeout', { signal: ac.signal }).then(() => {\n  prompt.cancel();\n  return 'Timed out!';\n});\n\nconst answer = await Promise.race([defaultValue, prompt]);\n```\n\n## Using as pre-commit/git hooks, or scripts\n\nBy default scripts ran from tools like `husky`/`lint-staged` might not run inside an interactive shell. In non-interactive shell, Inquirer cannot run, and users cannot send keypress events to the process.\n\nFor it to work, you must make sure you start a `tty` (or \"interactive\" input stream.)\n\nIf those scripts are set within your `package.json`, you can define the stream like so:\n\n```json\n  \"precommit\": \"my-script < /dev/tty\"\n```\n\nOr if in a shell script file, you'll do it like so: (on Windows that's likely your only option)\n\n```sh\n#!/bin/sh\nexec < /dev/tty\n\nnode my-script.js\n```\n\n## Wait for config\n\nMaybe some question configuration require to await a value.\n\n```js\nimport { confirm } from '@inquirer/prompts';\n\nconst answer = await confirm({ message: await getMessage() });\n```\n\n# Community prompts\n\nIf you created a cool prompt, [send us a PR adding it](https://github.com/SBoudrias/Inquirer.js/edit/master/README.md) to the list below!\n\n[**Interactive List Prompt**](https://github.com/pgibler/inquirer-interactive-list-prompt)<br/>\nSelect a choice either with arrow keys + Enter or by pressing a key associated with a choice.\n\n```\n? Choose an option:\n>   Run command (D)\n    Quit (Q)\n```\n\n[**Action Select Prompt**](https://github.com/zenithlight/inquirer-action-select)<br/>\nChoose an item from a list and choose an action to take by pressing a key.\n\n```\n? Choose a file Open <O> Edit <E> Delete <X>\n❯ image.png\n  audio.mp3\n  code.py\n```\n\n[**Table Multiple Prompt**](https://github.com/Bartheleway/inquirer-table-multiple)<br/>\nSelect multiple answer from a table display.\n\n```sh\nChoose between choices? (Press <space> to select, <Up and Down> to move rows,\n<Left and Right> to move columns)\n\n┌──────────┬───────┬───────┐\n│ 1-2 of 2 │ Yes?  │ No?   |\n├──────────┼───────┼───────┤\n│ Choice 1 │ [ ◯ ] │   ◯   |\n├──────────┼───────┼───────┤\n│ Choice 2 │   ◯   │   ◯   |\n└──────────┴───────┴───────┘\n\n```\n\n[**Toggle Prompt**](https://github.com/skarahoda/inquirer-toggle)<br/>\nConfirm with a toggle. Select a choice with arrow keys + Enter.\n\n```\n? Do you want to continue? no / yes\n```\n\n[**Sortable Checkbox Prompt**](https://github.com/th0r/inquirer-sortable-checkbox)<br/>\nThe same as built-in checkbox prompt, but also allowing to reorder choices using ctrl+up/down.\n\n```\n? Which PRs and in what order would you like to merge? (Press <space> to select, <a> to toggle all, <i> to invert selection, <ctrl+up> to move item up, <ctrl+down> to move item down, and <enter> to proceed)\n❯ ◯ PR 1\n  ◯ PR 2\n  ◯ PR 3\n```\n\n[**Multi Select Prompt**](https://github.com/jeffwcx/inquirer-select-pro)\n\nAn inquirer select that supports multiple selections and filtering/searching.\n\n```\n? Choose your OS, IDE, PL, etc. (Press <tab> to select/deselect, <backspace> to remove selected\noption, <enter> to select option)\n>>  vue\n>[ ] vue\n [ ] vuejs\n [ ] fuelphp\n [ ] venv\n [ ] vercel\n (Use arrow keys to reveal more options)\n```\n\n# License\n\nCopyright (c) 2023 Simon Boudrias (twitter: [@vaxilart](https://twitter.com/Vaxilart))<br/>\nLicensed under the MIT license.\n","publish_time":1699395770835,"_cnpm_publish_time":1699395770835,"dist-tags":{"latest":"8.8.0"}}