Gathering detailed insights and metrics for inquirer-sortable-checkbox
Gathering detailed insights and metrics for inquirer-sortable-checkbox
npm install inquirer-sortable-checkbox
Typescript
Module System
Min. Node Version
Node Version
NPM Version
87
Supply Chain
96.4
Quality
75.9
Maintenance
100
Vulnerability
99.6
License
TypeScript (85.61%)
JavaScript (14.39%)
Total Downloads
313,907
Last Day
1,847
Last Week
9,299
Last Month
36,563
Last Year
313,907
2 Stars
10 Commits
1 Watching
1 Branches
1 Contributors
Minified
Minified + Gzipped
Latest Version
1.0.1
Package Id
inquirer-sortable-checkbox@1.0.1
Unpacked Size
26.02 kB
Size
5.41 kB
File Count
6
NPM Version
10.5.0
Node Version
20.12.2
Publised On
26 Apr 2024
Cumulative downloads
Total Downloads
Last day
-52%
1,847
Compared to previous day
Last week
-31.1%
9,299
Compared to previous week
Last month
3%
36,563
Compared to previous month
Last year
0%
313,907
Compared to previous year
5
Simple interactive command line prompt to display a sortable list of checkboxes (multi select).
1npm install inquirer-sortable-checkbox 2 3yarn add inquirer-sortable-checkbox
1import sortableCheckbox from 'inquirer-sortable-checkbox';
2
3const answer = await sortableCheckbox({
4 message: 'Which PRs and in what order would you like to merge?',
5 choices: [
6 {
7 name: 'PR 1',
8 value: '#1',
9 },
10 {
11 name: 'PR 2',
12 value: '#2',
13 disabled: true,
14 },
15 {
16 name: 'PR 3',
17 value: '#3',
18 checked: true,
19 },
20 ],
21});
Property | Type | Required | Description |
---|---|---|---|
message | string | yes | The question to ask |
choices | Array<{ value: any, name?: string, disabled?: boolean | string, checked?: boolean }> | yes | List of the available choices. The value will be returned as the answer, and used as display if no name is defined. Choices who're disabled will be displayed, but not selectable. |
pageSize | number | no | By default, lists of choice longer than 7 will be paginated. Use this option to control how many choices will appear on the screen at once. |
sortingLoop | boolean | no | Defaults to false . When set to true , moving first item up will move it to the end of the list, and moving last item down will move it to the start of the list. |
required | boolean | no | When set to true , ensures at least one choice must be selected. |
validate | string\[\] => boolean | string | Promise<string | boolean> | no | On submit, validate the choices. When returning a string, it'll be used as the error message displayed to the user. Note: returning a rejected promise, we'll assume a code error happened and crash. |
theme | See Theming | no | Customize look of the prompt. |
You can theme a prompt by passing a theme
object option. The theme object only need to includes the keys you wish to modify, we'll fallback on the defaults for the rest.
1type Theme = { 2 prefix: string; 3 spinner: { 4 interval: number; 5 frames: string[]; 6 }; 7 style: { 8 answer: (text: string) => string; 9 message: (text: string) => string; 10 error: (text: string) => string; 11 defaultAnswer: (text: string) => string; 12 help: (text: string) => string; 13 highlight: (text: string) => string; 14 key: (text: string) => string; 15 disabledChoice: (text: string) => string; 16 renderSelectedChoices: <T>( 17 selectedChoices: ReadonlyArray<Choice<T>>, 18 allChoices: ReadonlyArray<Choice<T> | Separator>, 19 ) => string; 20 }; 21 icon: { 22 checked: string; 23 unchecked: string; 24 cursor: string; 25 }; 26 helpMode: 'always' | 'never' | 'auto'; 27};
theme.helpMode
auto
(default): Hide the help tips after an interaction occurs. The scroll tip will hide after any interactions, the selection and sorting tip will hide as soon as a first sorting is done.always
: The help tips will always show and never hide.never
: The help tips will never show.Licensed under the MIT license.
No vulnerabilities found.
No security vulnerabilities found.