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
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@clack/prompts - npm Package Compare versions

Comparing version 0.4.3 to 0.4.4

11

CHANGELOG.md
# @clack/prompts
## 0.4.4
### Patch Changes
- d96071c: Don't mutate `initialValue` in `multiselect`, fix parameter type for `validate()`.
Credits to @banjo for the bug report and initial PR!
- Updated dependencies [d96071c]
- @clack/core@0.1.8
## 0.4.3

@@ -4,0 +15,0 @@

2

dist/index.d.ts

@@ -29,2 +29,3 @@ export { isCancel } from '@clack/core';

}
declare const select: <Options extends Option<Value>[], Value extends Primitive>(opts: SelectOptions<Options, Value>) => Promise<symbol | Options[number]["value"]>;
interface MultiSelectOptions<Options extends Option<Value>[], Value extends Primitive> {

@@ -37,3 +38,2 @@ message: string;

}
declare const select: <Options extends Option<Value>[], Value extends Primitive>(opts: SelectOptions<Options, Value>) => Promise<symbol | Options[number]["value"]>;
declare const multiselect: <Options extends Option<Value>[], Value extends Primitive>(opts: MultiSelectOptions<Options, Value>) => Promise<symbol | Options[number]["value"][]>;

@@ -40,0 +40,0 @@ declare const note: (message?: string, title?: string) => void;

{
"name": "@clack/prompts",
"version": "0.4.3",
"version": "0.4.4",
"type": "module",

@@ -52,3 +52,3 @@ "main": "./dist/index.cjs",

"dependencies": {
"@clack/core": "^0.1.6",
"@clack/core": "^0.1.8",
"picocolors": "^1.0.0",

@@ -55,0 +55,0 @@ "sisteransi": "^1.0.5"

@@ -123,1 +123,37 @@ # `@clack/prompts`

```
## Utilities
### Grouping
Grouping prompts together is a great way to keep your code organized. This accepts a JSON object with a name that can be used to reference the group later. The second argument is an optional but has a `onCancel` callback that will be called if the user cancels one of the prompts in the group.
```js
import * as p from '@clack/prompts';
const group = await p.group(
{
name: () => p.text({ message: 'What is your name?' }),
age: () => p.text({ message: 'What is your age?' }),
color: ({ results }) =>
p.multiselect({
message: `What is your favorite color ${results.name}?`,
options: [
{ value: 'red', label: 'Red' },
{ value: 'green', label: 'Green' },
{ value: 'blue', label: 'Blue' },
],
}),
},
{
// On Cancel callback that wraps the group
// So if the user cancels one of the prompts in the group this function will be called
onCancel: ({ results }) => {
p.cancel('Operation cancelled.');
process.exit(0);
},
}
);
console.log(group.name, group.age, group.color);
```

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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