@inquirer/demo 0.1.0
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.
- package/LICENSE +22 -0
- package/demos/checkbox.mjs +65 -0
- package/demos/confirm.mjs +42 -0
- package/demos/editor.mjs +25 -0
- package/demos/expand.mjs +98 -0
- package/demos/input.mjs +57 -0
- package/demos/password.mjs +28 -0
- package/demos/rawlist.mjs +67 -0
- package/demos/select.mjs +69 -0
- package/index.mjs +48 -0
- package/package.json +71 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright (c) 2023 Simon Boudrias
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person
|
|
4
|
+
obtaining a copy of this software and associated documentation
|
|
5
|
+
files (the "Software"), to deal in the Software without
|
|
6
|
+
restriction, including without limitation the rights to use,
|
|
7
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
copies of the Software, and to permit persons to whom the
|
|
9
|
+
Software is furnished to do so, subject to the following
|
|
10
|
+
conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be
|
|
13
|
+
included in all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
16
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
17
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
18
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
19
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
20
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
21
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
22
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import * as url from 'node:url';
|
|
2
|
+
import { checkbox, Separator } from '@inquirer/prompts';
|
|
3
|
+
|
|
4
|
+
const demo = async () => {
|
|
5
|
+
let answer;
|
|
6
|
+
|
|
7
|
+
answer = await checkbox({
|
|
8
|
+
message: 'Select a package manager',
|
|
9
|
+
choices: [
|
|
10
|
+
{ name: 'npm', value: 'npm' },
|
|
11
|
+
{ name: 'yarn', value: 'yarn' },
|
|
12
|
+
new Separator(),
|
|
13
|
+
{ name: 'jspm', value: 'jspm', disabled: true },
|
|
14
|
+
{
|
|
15
|
+
name: 'pnpm',
|
|
16
|
+
value: 'pnpm',
|
|
17
|
+
disabled: '(pnpm is not available)',
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
});
|
|
21
|
+
console.log('Answer:', answer);
|
|
22
|
+
|
|
23
|
+
answer = await checkbox({
|
|
24
|
+
message: 'Select your favorite letters',
|
|
25
|
+
choices: [
|
|
26
|
+
new Separator('== Alphabet (choices cycle as you scroll through) =='),
|
|
27
|
+
{ value: 'A', checked: true },
|
|
28
|
+
{ value: 'B' },
|
|
29
|
+
{ value: 'C', checked: true },
|
|
30
|
+
{ value: 'D' },
|
|
31
|
+
{ value: 'E' },
|
|
32
|
+
{ value: 'F' },
|
|
33
|
+
{ value: 'G' },
|
|
34
|
+
{ value: 'H' },
|
|
35
|
+
{ value: 'I' },
|
|
36
|
+
{ value: 'J' },
|
|
37
|
+
{ value: 'K' },
|
|
38
|
+
{ value: 'L' },
|
|
39
|
+
{ value: 'M' },
|
|
40
|
+
{ value: 'N' },
|
|
41
|
+
{ value: 'O' },
|
|
42
|
+
{ value: 'P' },
|
|
43
|
+
{ value: 'Q' },
|
|
44
|
+
{ value: 'R' },
|
|
45
|
+
{ value: 'S' },
|
|
46
|
+
{ value: 'T' },
|
|
47
|
+
{ value: 'U' },
|
|
48
|
+
{ value: 'V' },
|
|
49
|
+
{ value: 'W' },
|
|
50
|
+
{ value: 'X' },
|
|
51
|
+
{ value: 'Y' },
|
|
52
|
+
{ value: 'Z' },
|
|
53
|
+
],
|
|
54
|
+
});
|
|
55
|
+
console.log('Answer:', answer);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
if (import.meta.url.startsWith('file:')) {
|
|
59
|
+
const modulePath = url.fileURLToPath(import.meta.url);
|
|
60
|
+
if (process.argv[1] === modulePath) {
|
|
61
|
+
demo();
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export default demo;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as url from 'node:url';
|
|
2
|
+
import { confirm } from '@inquirer/prompts';
|
|
3
|
+
|
|
4
|
+
const demo = async () => {
|
|
5
|
+
console.log(
|
|
6
|
+
'Answer:',
|
|
7
|
+
await confirm({
|
|
8
|
+
message: 'Confirm?',
|
|
9
|
+
})
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
console.log(
|
|
13
|
+
'Answer:',
|
|
14
|
+
await confirm({
|
|
15
|
+
message: 'Confirm with default to no?',
|
|
16
|
+
default: false,
|
|
17
|
+
})
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
console.log(
|
|
21
|
+
'Answer:',
|
|
22
|
+
await confirm({
|
|
23
|
+
message: 'Confirm with your custom transformer function?',
|
|
24
|
+
transformer: (answer) => (answer ? '👍' : '👎'),
|
|
25
|
+
})
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
console.log('This next prompt will be cleared on exit');
|
|
29
|
+
console.log(
|
|
30
|
+
'Cleared prompt answer:',
|
|
31
|
+
await confirm({ message: 'Confirm?' }, { clearPromptOnDone: true })
|
|
32
|
+
);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
if (import.meta.url.startsWith('file:')) {
|
|
36
|
+
const modulePath = url.fileURLToPath(import.meta.url);
|
|
37
|
+
if (process.argv[1] === modulePath) {
|
|
38
|
+
demo();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export default demo;
|
package/demos/editor.mjs
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as url from 'node:url';
|
|
2
|
+
import { editor } from '@inquirer/prompts';
|
|
3
|
+
|
|
4
|
+
const demo = async () => {
|
|
5
|
+
const answer = await editor({
|
|
6
|
+
message: 'Please write a short bio of at least 3 lines.',
|
|
7
|
+
validate(text) {
|
|
8
|
+
if (text.trim().split('\n').length < 3) {
|
|
9
|
+
return 'Must be at least 3 lines.';
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return true;
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
console.log('Answer:', answer);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
if (import.meta.url.startsWith('file:')) {
|
|
19
|
+
const modulePath = url.fileURLToPath(import.meta.url);
|
|
20
|
+
if (process.argv[1] === modulePath) {
|
|
21
|
+
demo();
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default demo;
|
package/demos/expand.mjs
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import * as url from 'node:url';
|
|
2
|
+
import { expand } from '@inquirer/prompts';
|
|
3
|
+
|
|
4
|
+
const demo = async () => {
|
|
5
|
+
let answer;
|
|
6
|
+
|
|
7
|
+
answer = await expand({
|
|
8
|
+
message: 'Conflict on `file.js`:',
|
|
9
|
+
choices: [
|
|
10
|
+
{
|
|
11
|
+
key: 'y',
|
|
12
|
+
name: 'Overwrite',
|
|
13
|
+
value: 'overwrite',
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
key: 'a',
|
|
17
|
+
name: 'Overwrite this one and all next',
|
|
18
|
+
value: 'overwrite_all',
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
key: 'd',
|
|
22
|
+
name: 'Show diff',
|
|
23
|
+
value: 'diff',
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
key: 'x',
|
|
27
|
+
name: 'Abort',
|
|
28
|
+
value: 'abort',
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
});
|
|
32
|
+
console.log('Answer:', answer);
|
|
33
|
+
|
|
34
|
+
answer = await expand({
|
|
35
|
+
message: '(With default) Conflict on `file.js`:',
|
|
36
|
+
default: 'y',
|
|
37
|
+
choices: [
|
|
38
|
+
{
|
|
39
|
+
key: 'y',
|
|
40
|
+
name: 'Overwrite',
|
|
41
|
+
value: 'overwrite',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
key: 'a',
|
|
45
|
+
name: 'Overwrite this one and all next',
|
|
46
|
+
value: 'overwrite_all',
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
key: 'd',
|
|
50
|
+
name: 'Show diff',
|
|
51
|
+
value: 'diff',
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
key: 'x',
|
|
55
|
+
name: 'Abort',
|
|
56
|
+
value: 'abort',
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
});
|
|
60
|
+
console.log('Answer:', answer);
|
|
61
|
+
|
|
62
|
+
answer = await expand({
|
|
63
|
+
expanded: true,
|
|
64
|
+
message: '(Auto-expand) Conflict on `file.js`:',
|
|
65
|
+
choices: [
|
|
66
|
+
{
|
|
67
|
+
key: 'y',
|
|
68
|
+
name: 'Overwrite',
|
|
69
|
+
value: 'overwrite',
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
key: 'a',
|
|
73
|
+
name: 'Overwrite this one and all next',
|
|
74
|
+
value: 'overwrite_all',
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
key: 'd',
|
|
78
|
+
name: 'Show diff',
|
|
79
|
+
value: 'diff',
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
key: 'x',
|
|
83
|
+
name: 'Abort',
|
|
84
|
+
value: 'abort',
|
|
85
|
+
},
|
|
86
|
+
],
|
|
87
|
+
});
|
|
88
|
+
console.log('Answer:', answer);
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
if (import.meta.url.startsWith('file:')) {
|
|
92
|
+
const modulePath = url.fileURLToPath(import.meta.url);
|
|
93
|
+
if (process.argv[1] === modulePath) {
|
|
94
|
+
demo();
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export default demo;
|
package/demos/input.mjs
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import * as url from 'node:url';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import { input } from '@inquirer/prompts';
|
|
4
|
+
|
|
5
|
+
const hexRegEx = /([0-9]|[a-f])/gim;
|
|
6
|
+
const isHex = (value) =>
|
|
7
|
+
(value.match(hexRegEx) || []).length === value.length &&
|
|
8
|
+
(value.length === 3 || value.length === 6);
|
|
9
|
+
|
|
10
|
+
const demo = async () => {
|
|
11
|
+
let answer;
|
|
12
|
+
|
|
13
|
+
answer = await input({
|
|
14
|
+
message: "What's your favorite food?",
|
|
15
|
+
default: 'Croissant',
|
|
16
|
+
});
|
|
17
|
+
console.log('Answer:', answer);
|
|
18
|
+
|
|
19
|
+
answer = await input({
|
|
20
|
+
message: 'Enter an hex color?',
|
|
21
|
+
transformer(value = '', { isFinal }) {
|
|
22
|
+
const color = chalk.hex(isHex(value) ? value : 'fff');
|
|
23
|
+
return isFinal ? color.underline(value) : color(value);
|
|
24
|
+
},
|
|
25
|
+
validate: (value = '') => isHex(value) || 'Pass a valid hex value',
|
|
26
|
+
});
|
|
27
|
+
console.log('Answer:', answer);
|
|
28
|
+
|
|
29
|
+
answer = await input({
|
|
30
|
+
message: '(Slow validation) provide a number:',
|
|
31
|
+
validate: (value) =>
|
|
32
|
+
new Promise((resolve) => {
|
|
33
|
+
setTimeout(
|
|
34
|
+
() => resolve(!Number.isNaN(Number(value)) || 'You must provide a number'),
|
|
35
|
+
3000
|
|
36
|
+
);
|
|
37
|
+
}),
|
|
38
|
+
});
|
|
39
|
+
console.log('Answer:', answer);
|
|
40
|
+
|
|
41
|
+
answer = await input({
|
|
42
|
+
message: () =>
|
|
43
|
+
new Promise((resolve) => {
|
|
44
|
+
setTimeout(() => resolve('(Slow message) Input any value:'), 3000);
|
|
45
|
+
}),
|
|
46
|
+
});
|
|
47
|
+
console.log('Answer:', answer);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
if (import.meta.url.startsWith('file:')) {
|
|
51
|
+
const modulePath = url.fileURLToPath(import.meta.url);
|
|
52
|
+
if (process.argv[1] === modulePath) {
|
|
53
|
+
demo();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export default demo;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as url from 'node:url';
|
|
2
|
+
import { password } from '@inquirer/prompts';
|
|
3
|
+
|
|
4
|
+
const demo = async () => {
|
|
5
|
+
console.log(
|
|
6
|
+
'Answer:',
|
|
7
|
+
await password({
|
|
8
|
+
message: 'Enter a silent password?',
|
|
9
|
+
})
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
console.log(
|
|
13
|
+
'Answer:',
|
|
14
|
+
await password({
|
|
15
|
+
message: 'Enter a masked password?',
|
|
16
|
+
mask: '*',
|
|
17
|
+
})
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
if (import.meta.url.startsWith('file:')) {
|
|
22
|
+
const modulePath = url.fileURLToPath(import.meta.url);
|
|
23
|
+
if (process.argv[1] === modulePath) {
|
|
24
|
+
demo();
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export default demo;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import * as url from 'node:url';
|
|
2
|
+
import { rawlist, Separator } from '@inquirer/prompts';
|
|
3
|
+
|
|
4
|
+
const demo = async () => {
|
|
5
|
+
let answer;
|
|
6
|
+
|
|
7
|
+
answer = await rawlist({
|
|
8
|
+
message: '(no keys) Conflict on `file.js`:',
|
|
9
|
+
choices: [
|
|
10
|
+
{
|
|
11
|
+
name: 'Overwrite',
|
|
12
|
+
value: 'overwrite',
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
name: 'Overwrite this one and all next',
|
|
16
|
+
value: 'overwrite_all',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
name: 'Show diff',
|
|
20
|
+
value: 'diff',
|
|
21
|
+
},
|
|
22
|
+
new Separator(),
|
|
23
|
+
{
|
|
24
|
+
name: 'Abort',
|
|
25
|
+
value: 'abort',
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
});
|
|
29
|
+
console.log('Answer:', answer);
|
|
30
|
+
|
|
31
|
+
answer = await rawlist({
|
|
32
|
+
message: '(with keys) Conflict on `file.js`:',
|
|
33
|
+
choices: [
|
|
34
|
+
{
|
|
35
|
+
key: 'y',
|
|
36
|
+
name: 'Overwrite',
|
|
37
|
+
value: 'overwrite',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
key: 'a',
|
|
41
|
+
name: 'Overwrite this one and all next',
|
|
42
|
+
value: 'overwrite_all',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
key: 'd',
|
|
46
|
+
name: 'Show diff',
|
|
47
|
+
value: 'diff',
|
|
48
|
+
},
|
|
49
|
+
new Separator(),
|
|
50
|
+
{
|
|
51
|
+
key: 'x',
|
|
52
|
+
name: 'Abort',
|
|
53
|
+
value: 'abort',
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
});
|
|
57
|
+
console.log('Answer:', answer);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
if (import.meta.url.startsWith('file:')) {
|
|
61
|
+
const modulePath = url.fileURLToPath(import.meta.url);
|
|
62
|
+
if (process.argv[1] === modulePath) {
|
|
63
|
+
demo();
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export default demo;
|
package/demos/select.mjs
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import * as url from 'node:url';
|
|
2
|
+
import { select, Separator } from '@inquirer/prompts';
|
|
3
|
+
|
|
4
|
+
const demo = async () => {
|
|
5
|
+
let answer;
|
|
6
|
+
|
|
7
|
+
answer = await select({
|
|
8
|
+
message: 'Select a package manager',
|
|
9
|
+
choices: [
|
|
10
|
+
{
|
|
11
|
+
name: 'npm',
|
|
12
|
+
value: 'npm',
|
|
13
|
+
description: 'npm is the most popular package manager',
|
|
14
|
+
},
|
|
15
|
+
{ name: 'yarn', value: 'yarn', description: 'yarn is an awesome package manager' },
|
|
16
|
+
new Separator(),
|
|
17
|
+
{ name: 'jspm', value: 'jspm', disabled: true },
|
|
18
|
+
{
|
|
19
|
+
name: 'pnpm',
|
|
20
|
+
value: 'pnpm',
|
|
21
|
+
disabled: '(pnpm is not available)',
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
});
|
|
25
|
+
console.log('Answer:', answer);
|
|
26
|
+
|
|
27
|
+
answer = await select({
|
|
28
|
+
message: 'Select your favorite letter',
|
|
29
|
+
choices: [
|
|
30
|
+
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' },
|
|
57
|
+
],
|
|
58
|
+
});
|
|
59
|
+
console.log('Answer:', answer);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
if (import.meta.url.startsWith('file:')) {
|
|
63
|
+
const modulePath = url.fileURLToPath(import.meta.url);
|
|
64
|
+
if (process.argv[1] === modulePath) {
|
|
65
|
+
demo();
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export default demo;
|
package/index.mjs
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/* eslint-disable no-await-in-loop */
|
|
3
|
+
|
|
4
|
+
import { select } from '@inquirer/prompts';
|
|
5
|
+
import checkboxDemo from './demos/checkbox.mjs';
|
|
6
|
+
import confirmDemo from './demos/confirm.mjs';
|
|
7
|
+
import editorDemo from './demos/editor.mjs';
|
|
8
|
+
import expandDemo from './demos/expand.mjs';
|
|
9
|
+
import inputDemo from './demos/input.mjs';
|
|
10
|
+
import passwordDemo from './demos/password.mjs';
|
|
11
|
+
import rawlistDemo from './demos/rawlist.mjs';
|
|
12
|
+
import selectDemo from './demos/select.mjs';
|
|
13
|
+
|
|
14
|
+
const demos = {
|
|
15
|
+
checkbox: checkboxDemo,
|
|
16
|
+
confirm: confirmDemo,
|
|
17
|
+
editor: editorDemo,
|
|
18
|
+
expand: expandDemo,
|
|
19
|
+
input: inputDemo,
|
|
20
|
+
password: passwordDemo,
|
|
21
|
+
rawlist: rawlistDemo,
|
|
22
|
+
select: selectDemo,
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
function askNextDemo() {
|
|
26
|
+
return select({
|
|
27
|
+
message: 'Which prompt demo do you want to run?',
|
|
28
|
+
choices: [
|
|
29
|
+
{ name: 'Input', value: 'input' },
|
|
30
|
+
{ name: 'Password', value: 'password' },
|
|
31
|
+
{ name: 'Confirm', value: 'confirm' },
|
|
32
|
+
{ name: 'Select', value: 'select' },
|
|
33
|
+
{ name: 'Checkbox', value: 'checkbox' },
|
|
34
|
+
{ name: 'Expand', value: 'expand' },
|
|
35
|
+
{ name: 'Rawlist', value: 'rawlist' },
|
|
36
|
+
{ name: 'Editor', value: 'editor' },
|
|
37
|
+
{ name: "Exit (I'm done)", value: 'exit' },
|
|
38
|
+
],
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
(async () => {
|
|
43
|
+
let nextDemo = await askNextDemo();
|
|
44
|
+
while (nextDemo !== 'exit') {
|
|
45
|
+
await demos[nextDemo]();
|
|
46
|
+
nextDemo = await askNextDemo();
|
|
47
|
+
}
|
|
48
|
+
})();
|
package/package.json
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@inquirer/demo",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"engines": {
|
|
5
|
+
"node": ">=14.18.0"
|
|
6
|
+
},
|
|
7
|
+
"type": "module",
|
|
8
|
+
"description": "Inquirer demos",
|
|
9
|
+
"main": "index.mjs",
|
|
10
|
+
"bin": {
|
|
11
|
+
"inquirer-demo": "index.mjs"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"index.mjs",
|
|
15
|
+
"demos/"
|
|
16
|
+
],
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "https://github.com/SBoudrias/Inquirer.js.git"
|
|
20
|
+
},
|
|
21
|
+
"keywords": [
|
|
22
|
+
"answer",
|
|
23
|
+
"answers",
|
|
24
|
+
"ask",
|
|
25
|
+
"base",
|
|
26
|
+
"cli",
|
|
27
|
+
"command",
|
|
28
|
+
"command-line",
|
|
29
|
+
"confirm",
|
|
30
|
+
"enquirer",
|
|
31
|
+
"generate",
|
|
32
|
+
"generator",
|
|
33
|
+
"hyper",
|
|
34
|
+
"input",
|
|
35
|
+
"inquire",
|
|
36
|
+
"inquirer",
|
|
37
|
+
"interface",
|
|
38
|
+
"iterm",
|
|
39
|
+
"javascript",
|
|
40
|
+
"menu",
|
|
41
|
+
"node",
|
|
42
|
+
"nodejs",
|
|
43
|
+
"prompt",
|
|
44
|
+
"promptly",
|
|
45
|
+
"prompts",
|
|
46
|
+
"question",
|
|
47
|
+
"readline",
|
|
48
|
+
"scaffold",
|
|
49
|
+
"scaffolder",
|
|
50
|
+
"scaffolding",
|
|
51
|
+
"stdin",
|
|
52
|
+
"stdout",
|
|
53
|
+
"terminal",
|
|
54
|
+
"tty",
|
|
55
|
+
"ui",
|
|
56
|
+
"yeoman",
|
|
57
|
+
"yo",
|
|
58
|
+
"zsh"
|
|
59
|
+
],
|
|
60
|
+
"author": "Simon Boudrias <admin@simonboudrias.com>",
|
|
61
|
+
"license": "MIT",
|
|
62
|
+
"homepage": "https://github.com/SBoudrias/Inquirer.js",
|
|
63
|
+
"dependencies": {
|
|
64
|
+
"@inquirer/prompts": "^1.2.3",
|
|
65
|
+
"chalk": "^4.1.2"
|
|
66
|
+
},
|
|
67
|
+
"publishConfig": {
|
|
68
|
+
"access": "public"
|
|
69
|
+
},
|
|
70
|
+
"gitHead": "235c18f13650735b201a8853b28eda001f953d0f"
|
|
71
|
+
}
|