@inquirer/demo 0.2.12 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/demos/select.mjs +40 -26
  2. package/package.json +3 -3
package/demos/select.mjs CHANGED
@@ -1,6 +1,35 @@
1
1
  import * as url from 'node:url';
2
2
  import { select, Separator } from '@inquirer/prompts';
3
3
 
4
+ const alphabet = [
5
+ { value: 'A' },
6
+ { value: 'B' },
7
+ { value: 'C' },
8
+ { value: 'D' },
9
+ { value: 'E' },
10
+ { value: 'F' },
11
+ { value: 'G' },
12
+ { value: 'H' },
13
+ { value: 'I' },
14
+ { value: 'J' },
15
+ { value: 'K' },
16
+ { value: 'L' },
17
+ { value: 'M' },
18
+ { value: 'N' },
19
+ { value: 'O', description: 'Letter O, not number 0' },
20
+ { value: 'P' },
21
+ { value: 'Q' },
22
+ { value: 'R' },
23
+ { value: 'S' },
24
+ { value: 'T' },
25
+ { value: 'U' },
26
+ { value: 'V' },
27
+ { value: 'W' },
28
+ { value: 'X' },
29
+ { value: 'Y' },
30
+ { value: 'Z' },
31
+ ];
32
+
4
33
  const demo = async () => {
5
34
  let answer;
6
35
 
@@ -28,33 +57,18 @@ const demo = async () => {
28
57
  message: 'Select your favorite letter',
29
58
  choices: [
30
59
  new Separator('== Alphabet (choices cycle as you scroll through) =='),
31
- { value: 'A' },
32
- { value: 'B' },
33
- { value: 'C' },
34
- { value: 'D' },
35
- { value: 'E' },
36
- { value: 'F' },
37
- { value: 'G' },
38
- { value: 'H' },
39
- { value: 'I' },
40
- { value: 'J' },
41
- { value: 'K' },
42
- { value: 'L' },
43
- { value: 'M' },
44
- { value: 'N' },
45
- { value: 'O', description: 'Letter O, not number 0' },
46
- { value: 'P' },
47
- { value: 'Q' },
48
- { value: 'R' },
49
- { value: 'S' },
50
- { value: 'T' },
51
- { value: 'U' },
52
- { value: 'V' },
53
- { value: 'W' },
54
- { value: 'X' },
55
- { value: 'Y' },
56
- { value: 'Z' },
60
+ ...alphabet,
61
+ ],
62
+ });
63
+ console.log('Answer:', answer);
64
+
65
+ answer = await select({
66
+ message: 'Select your favorite letter (example without loop)',
67
+ choices: [
68
+ new Separator('== Alphabet (choices cycle as you scroll through) =='),
69
+ ...alphabet,
57
70
  ],
71
+ loop: false,
58
72
  });
59
73
  console.log('Answer:', answer);
60
74
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inquirer/demo",
3
- "version": "0.2.12",
3
+ "version": "0.3.1",
4
4
  "engines": {
5
5
  "node": ">=14.18.0"
6
6
  },
@@ -61,11 +61,11 @@
61
61
  "license": "MIT",
62
62
  "homepage": "https://github.com/SBoudrias/Inquirer.js",
63
63
  "dependencies": {
64
- "@inquirer/prompts": "^3.1.2",
64
+ "@inquirer/prompts": "^3.3.0",
65
65
  "chalk": "^4.1.2"
66
66
  },
67
67
  "publishConfig": {
68
68
  "access": "public"
69
69
  },
70
- "gitHead": "85784061d702778bc9dd48ca08f09ee9976b06ee"
70
+ "gitHead": "a318aec57d33b53131c0b03cc8dd6ab4efae3e50"
71
71
  }