@shell-shock/preset-cli 0.4.1 → 0.5.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/README.md +1 -1
- package/dist/components/banner-function-declaration.cjs +1 -1
- package/dist/components/banner-function-declaration.d.cts +2 -2
- package/dist/components/banner-function-declaration.d.mts +2 -2
- package/dist/components/banner-function-declaration.d.mts.map +1 -1
- package/dist/components/banner-function-declaration.mjs +1 -1
- package/dist/components/banner-function-declaration.mjs.map +1 -1
- package/dist/components/command-entry.cjs +18 -11
- package/dist/components/command-entry.d.cts.map +1 -1
- package/dist/components/command-entry.d.mts +2 -2
- package/dist/components/command-entry.d.mts.map +1 -1
- package/dist/components/command-entry.mjs +18 -11
- package/dist/components/command-entry.mjs.map +1 -1
- package/dist/components/command-router.d.cts +3 -3
- package/dist/components/command-router.d.mts +3 -3
- package/dist/components/prompts-builtin.cjs +83 -65
- package/dist/components/prompts-builtin.d.cts +8 -8
- package/dist/components/prompts-builtin.d.cts.map +1 -1
- package/dist/components/prompts-builtin.d.mts.map +1 -1
- package/dist/components/prompts-builtin.mjs +83 -65
- package/dist/components/prompts-builtin.mjs.map +1 -1
- package/dist/components/virtual-command-entry.d.cts +2 -2
- package/dist/components/virtual-command-entry.d.mts +2 -2
- package/package.json +9 -9
|
@@ -82,35 +82,6 @@ function BasePromptDeclarations() {
|
|
|
82
82
|
returnType: "string",
|
|
83
83
|
children: code`return " ".repeat(input.length); `
|
|
84
84
|
}),
|
|
85
|
-
createComponent(Spacing, {}),
|
|
86
|
-
code`
|
|
87
|
-
const DEFAULT_ICONS = process.platform === "win32" ? {
|
|
88
|
-
arrowUp: "↑",
|
|
89
|
-
arrowDown: "↓",
|
|
90
|
-
arrowLeft: "←",
|
|
91
|
-
arrowRight: "→",
|
|
92
|
-
radioOn: "(*)",
|
|
93
|
-
radioOff: "( )",
|
|
94
|
-
tick: "√",
|
|
95
|
-
cross: "×",
|
|
96
|
-
ellipsis: "...",
|
|
97
|
-
pointerSmall: "»",
|
|
98
|
-
line: "─",
|
|
99
|
-
pointer: ">"
|
|
100
|
-
} : {
|
|
101
|
-
arrowUp: "↑",
|
|
102
|
-
arrowDown: "↓",
|
|
103
|
-
arrowLeft: "←",
|
|
104
|
-
arrowRight: "→",
|
|
105
|
-
radioOn: "◉",
|
|
106
|
-
radioOff: "◯",
|
|
107
|
-
tick: "✔",
|
|
108
|
-
cross: "✖",
|
|
109
|
-
ellipsis: "…",
|
|
110
|
-
pointerSmall: "›",
|
|
111
|
-
line: "─",
|
|
112
|
-
pointer: "❯"
|
|
113
|
-
}; `,
|
|
114
85
|
createComponent(Spacing, {}),
|
|
115
86
|
createComponent(InterfaceDeclaration, {
|
|
116
87
|
"export": true,
|
|
@@ -240,7 +211,13 @@ function BasePromptDeclarations() {
|
|
|
240
211
|
type: "string",
|
|
241
212
|
doc: "The default error message to display when validation fails"
|
|
242
213
|
}),
|
|
243
|
-
createComponent(Spacing, {})
|
|
214
|
+
createComponent(Spacing, {}),
|
|
215
|
+
createComponent(InterfaceMember, {
|
|
216
|
+
name: "timeout",
|
|
217
|
+
optional: true,
|
|
218
|
+
type: "number",
|
|
219
|
+
doc: "The timeout duration in milliseconds for the prompt. If none is provided, the prompt will not time out."
|
|
220
|
+
})
|
|
244
221
|
];
|
|
245
222
|
}
|
|
246
223
|
}),
|
|
@@ -275,7 +252,7 @@ function BasePromptDeclarations() {
|
|
|
275
252
|
type: "boolean",
|
|
276
253
|
children: code`false; `
|
|
277
254
|
}),
|
|
278
|
-
|
|
255
|
+
createComponent(Spacing, {}),
|
|
279
256
|
createComponent(ClassField, {
|
|
280
257
|
name: "initialValue",
|
|
281
258
|
abstract: true,
|
|
@@ -433,6 +410,14 @@ function BasePromptDeclarations() {
|
|
|
433
410
|
this.formatter = config.format.bind(this);
|
|
434
411
|
}
|
|
435
412
|
|
|
413
|
+
if (config.timeout !== undefined && !Number.isNaN(config.timeout)) {
|
|
414
|
+
setTimeout(() => {
|
|
415
|
+
if (!this.isCompleted) {
|
|
416
|
+
this.cancel();
|
|
417
|
+
}
|
|
418
|
+
}, config.timeout);
|
|
419
|
+
}
|
|
420
|
+
|
|
436
421
|
this.message = config.message;
|
|
437
422
|
|
|
438
423
|
this.#readline = readline.createInterface({
|
|
@@ -488,12 +473,12 @@ function BasePromptDeclarations() {
|
|
|
488
473
|
"protected": true,
|
|
489
474
|
name: "status",
|
|
490
475
|
type: "string",
|
|
491
|
-
children: code`return this.
|
|
476
|
+
children: code`return this.isCompleted ? "" : \` \\n \${
|
|
492
477
|
colors.italic(
|
|
493
478
|
this.isError
|
|
494
|
-
? colors.text.prompt.description.error(splitText(this.errorMessage, "
|
|
495
|
-
: this.
|
|
496
|
-
? colors.text.prompt.description.active(this.description)
|
|
479
|
+
? colors.text.prompt.description.error(splitText(this.errorMessage, "3/4").join("\\n"))
|
|
480
|
+
: this.description
|
|
481
|
+
? colors.text.prompt.description.active(splitText(this.description, "3/4").join("\\n"))
|
|
497
482
|
: ""
|
|
498
483
|
)
|
|
499
484
|
}\`; `
|
|
@@ -812,20 +797,27 @@ function BasePromptDeclarations() {
|
|
|
812
797
|
createComponent(VarDeclaration, {
|
|
813
798
|
"export": true,
|
|
814
799
|
name: "CANCEL_SYMBOL",
|
|
815
|
-
doc: "A unique symbol used to indicate that a prompt was cancelled, which can be returned from a prompt
|
|
800
|
+
doc: "A unique symbol used to indicate that a prompt was cancelled, which can be returned from a prompt function to signal that the prompt interaction should be cancelled and any pending promises should be rejected with this symbol. This allows for a consistent way to handle prompt cancellations across different prompt types and interactions.",
|
|
816
801
|
children: code`Symbol("shell-shock:prompts:cancel"); `
|
|
817
802
|
}),
|
|
818
803
|
createComponent(Spacing, {}),
|
|
804
|
+
createComponent(TSDoc, {
|
|
805
|
+
heading: "A utility function to check if a given value is the {@link CANCEL_SYMBOL | cancel symbol}, which can be used to determine if a prompt interaction was cancelled based on the value returned from a prompt factory function. This function checks if the provided value is strictly equal to the {@link CANCEL_SYMBOL | CANCEL_SYMBOL}, allowing for a consistent way to handle prompt cancellations across different prompt types and interactions.",
|
|
806
|
+
get children() {
|
|
807
|
+
return [createComponent(TSDocParam, {
|
|
808
|
+
name: "value",
|
|
809
|
+
children: `The value to check.`
|
|
810
|
+
}), createComponent(TSDocReturns, { children: `A boolean indicating whether the provided value is the {@link CANCEL_SYMBOL | cancel symbol}, which can be used to determine if a prompt interaction was cancelled.` })];
|
|
811
|
+
}
|
|
812
|
+
}),
|
|
819
813
|
createComponent(FunctionDeclaration, {
|
|
820
814
|
name: "isCancel",
|
|
821
815
|
"export": true,
|
|
822
|
-
doc: "Checks if a given value is a {@link CANCEL_SYMBOL | cancel symbol}.",
|
|
823
816
|
parameters: [{
|
|
824
817
|
name: "value",
|
|
825
|
-
type: "any"
|
|
826
|
-
doc: "The value to check"
|
|
818
|
+
type: "any"
|
|
827
819
|
}],
|
|
828
|
-
returnType: "
|
|
820
|
+
returnType: "value is typeof CANCEL_SYMBOL",
|
|
829
821
|
children: code`return value === CANCEL_SYMBOL; `
|
|
830
822
|
})
|
|
831
823
|
];
|
|
@@ -874,6 +866,7 @@ function TextPromptDeclarations() {
|
|
|
874
866
|
createComponent(ClassField, {
|
|
875
867
|
name: "initialValue",
|
|
876
868
|
"protected": true,
|
|
869
|
+
override: true,
|
|
877
870
|
type: "string",
|
|
878
871
|
children: code`""; `
|
|
879
872
|
}),
|
|
@@ -1107,7 +1100,7 @@ function TextPromptDeclarations() {
|
|
|
1107
1100
|
get children() {
|
|
1108
1101
|
return [
|
|
1109
1102
|
createComponent(TSDocRemarks, { children: code`This function can be used to easily create and run a text prompt without needing to manually create an instance of the TextPrompt class and handle its events. The function accepts a configuration object that extends the base PromptFactoryConfig with additional options specific to text prompts, such as the initial value and mask function. The returned promise allows for easy handling of the prompt result using async/await syntax or traditional promise chaining.` }),
|
|
1110
|
-
createComponent(TSDocExample, { children: `import { text, isCancel } from "shell-shock
|
|
1103
|
+
createComponent(TSDocExample, { children: `import { text, isCancel } from "shell-shock:prompts";
|
|
1111
1104
|
|
|
1112
1105
|
async function run() {
|
|
1113
1106
|
const name = await text({
|
|
@@ -1159,6 +1152,10 @@ function SelectPromptDeclarations() {
|
|
|
1159
1152
|
createComponent(InterfaceDeclaration, {
|
|
1160
1153
|
name: "PromptOptionConfig",
|
|
1161
1154
|
doc: "Configuration for an option the user can select from the select prompt",
|
|
1155
|
+
typeParameters: [{
|
|
1156
|
+
name: "TValue",
|
|
1157
|
+
default: "string"
|
|
1158
|
+
}],
|
|
1162
1159
|
get children() {
|
|
1163
1160
|
return [
|
|
1164
1161
|
createComponent(InterfaceMember, {
|
|
@@ -1177,7 +1174,7 @@ function SelectPromptDeclarations() {
|
|
|
1177
1174
|
createComponent(Spacing, {}),
|
|
1178
1175
|
createComponent(InterfaceMember, {
|
|
1179
1176
|
name: "value",
|
|
1180
|
-
type: "
|
|
1177
|
+
type: "TValue",
|
|
1181
1178
|
doc: "The value of the option"
|
|
1182
1179
|
}),
|
|
1183
1180
|
createComponent(Spacing, {}),
|
|
@@ -1208,10 +1205,19 @@ function SelectPromptDeclarations() {
|
|
|
1208
1205
|
createComponent(InterfaceDeclaration, {
|
|
1209
1206
|
"export": true,
|
|
1210
1207
|
name: "PromptOption",
|
|
1211
|
-
"extends": "PromptOptionConfig",
|
|
1208
|
+
"extends": "PromptOptionConfig<TValue>",
|
|
1212
1209
|
doc: "An option the user can select from the select prompt",
|
|
1210
|
+
typeParameters: [{
|
|
1211
|
+
name: "TValue",
|
|
1212
|
+
default: "string"
|
|
1213
|
+
}],
|
|
1213
1214
|
get children() {
|
|
1214
1215
|
return [
|
|
1216
|
+
createComponent(InterfaceMember, {
|
|
1217
|
+
name: "label",
|
|
1218
|
+
type: "string",
|
|
1219
|
+
doc: "The message label for the option"
|
|
1220
|
+
}),
|
|
1215
1221
|
createComponent(InterfaceMember, {
|
|
1216
1222
|
name: "index",
|
|
1217
1223
|
type: "number",
|
|
@@ -1235,8 +1241,12 @@ function SelectPromptDeclarations() {
|
|
|
1235
1241
|
createComponent(Spacing, {}),
|
|
1236
1242
|
createComponent(InterfaceDeclaration, {
|
|
1237
1243
|
name: "SelectPromptConfig",
|
|
1238
|
-
"extends": "PromptConfig<
|
|
1244
|
+
"extends": "PromptConfig<TValue>",
|
|
1239
1245
|
doc: "An options object for configuring a select prompt",
|
|
1246
|
+
typeParameters: [{
|
|
1247
|
+
name: "TValue",
|
|
1248
|
+
default: "string"
|
|
1249
|
+
}],
|
|
1240
1250
|
get children() {
|
|
1241
1251
|
return [
|
|
1242
1252
|
createComponent(InterfaceMember, {
|
|
@@ -1248,7 +1258,7 @@ function SelectPromptDeclarations() {
|
|
|
1248
1258
|
createComponent(Spacing, {}),
|
|
1249
1259
|
createComponent(InterfaceMember, {
|
|
1250
1260
|
name: "options",
|
|
1251
|
-
type: "Array<string | PromptOptionConfig
|
|
1261
|
+
type: "Array<string | PromptOptionConfig<TValue>>",
|
|
1252
1262
|
doc: "The options available for the select prompt"
|
|
1253
1263
|
}),
|
|
1254
1264
|
createComponent(Spacing, {}),
|
|
@@ -1268,13 +1278,14 @@ function SelectPromptDeclarations() {
|
|
|
1268
1278
|
"extends": "Prompt<TValue>",
|
|
1269
1279
|
typeParameters: [{
|
|
1270
1280
|
name: "TValue",
|
|
1271
|
-
default: "
|
|
1281
|
+
default: "string"
|
|
1272
1282
|
}],
|
|
1273
1283
|
get children() {
|
|
1274
1284
|
return [
|
|
1275
1285
|
createComponent(ClassField, {
|
|
1276
1286
|
name: "initialValue",
|
|
1277
1287
|
"protected": true,
|
|
1288
|
+
override: true,
|
|
1278
1289
|
type: "TValue"
|
|
1279
1290
|
}),
|
|
1280
1291
|
createIntrinsic("hbr", {}),
|
|
@@ -1288,47 +1299,48 @@ function SelectPromptDeclarations() {
|
|
|
1288
1299
|
createComponent(ClassField, {
|
|
1289
1300
|
name: "options",
|
|
1290
1301
|
"protected": true,
|
|
1291
|
-
type: "PromptOption[]",
|
|
1302
|
+
type: "PromptOption<TValue>[]",
|
|
1292
1303
|
children: code`[]; `
|
|
1293
1304
|
}),
|
|
1294
1305
|
createComponent(Spacing, {}),
|
|
1295
|
-
code`constructor(config: SelectPromptConfig) {
|
|
1306
|
+
code`constructor(config: SelectPromptConfig<TValue>) {
|
|
1296
1307
|
super(config);
|
|
1297
1308
|
|
|
1298
1309
|
if (config.initialValue) {
|
|
1299
|
-
this.initialValue = config.initialValue;
|
|
1310
|
+
this.initialValue = config.initialValue as TValue;
|
|
1311
|
+
} else {
|
|
1312
|
+
this.initialValue = undefined as unknown as TValue;
|
|
1300
1313
|
}
|
|
1301
1314
|
|
|
1302
|
-
this.options = config.options.map(opt => {
|
|
1303
|
-
let option
|
|
1315
|
+
this.options = config.options.map((opt, index) => {
|
|
1316
|
+
let option = {} as Partial<PromptOption<TValue>>;
|
|
1304
1317
|
if (typeof opt === "string") {
|
|
1305
|
-
option = {
|
|
1318
|
+
option = { label: opt, value: opt as TValue, selected: false, disabled: false };
|
|
1306
1319
|
} else if (typeof opt === "object") {
|
|
1307
|
-
option = opt
|
|
1320
|
+
option = opt;
|
|
1308
1321
|
} else {
|
|
1309
1322
|
throw new Error(\`Invalid option provided to SelectPrompt at index #\${index}\`);
|
|
1310
1323
|
}
|
|
1311
1324
|
|
|
1312
1325
|
return {
|
|
1313
|
-
label: String(option.value),
|
|
1326
|
+
label: String(option.value) || "",
|
|
1314
1327
|
...option,
|
|
1315
|
-
index: -1,
|
|
1316
1328
|
description: option.description,
|
|
1317
1329
|
selected: !!option.selected || (this.initialValue !== undefined && option.value === this.initialValue),
|
|
1318
1330
|
disabled: !!option.disabled
|
|
1319
|
-
}
|
|
1331
|
+
} as PromptOption<TValue>;
|
|
1320
1332
|
}).sort((a, b) => a.label.localeCompare(b.label)).map((option, index) => ({ ...option, index }));
|
|
1321
1333
|
|
|
1322
1334
|
const selected = this.options.findIndex(option => option.selected);
|
|
1323
1335
|
if (selected > -1) {
|
|
1324
1336
|
this.cursor = selected;
|
|
1325
1337
|
if (this.options[this.cursor]) {
|
|
1326
|
-
this.initialValue = this.options[this.cursor].value;
|
|
1338
|
+
this.initialValue = this.options[this.cursor].value as TValue;
|
|
1327
1339
|
}
|
|
1328
1340
|
}
|
|
1329
1341
|
|
|
1330
1342
|
if (this.initialValue === undefined && this.options.length > 0 && this.options[0]) {
|
|
1331
|
-
this.initialValue = this.options[0].value;
|
|
1343
|
+
this.initialValue = this.options[0].value as TValue;
|
|
1332
1344
|
}
|
|
1333
1345
|
|
|
1334
1346
|
if (config.optionsPerPage) {
|
|
@@ -1341,9 +1353,9 @@ function SelectPromptDeclarations() {
|
|
|
1341
1353
|
createComponent(ClassPropertyGet, {
|
|
1342
1354
|
doc: "Returns the currently selected option",
|
|
1343
1355
|
name: "selectedOption",
|
|
1344
|
-
type: "PromptOption | null",
|
|
1356
|
+
type: "PromptOption<TValue> | null",
|
|
1345
1357
|
"protected": true,
|
|
1346
|
-
children: code`return this.options
|
|
1358
|
+
children: code`return this.options.find(option => option.value === this.value) ?? null; `
|
|
1347
1359
|
}),
|
|
1348
1360
|
createComponent(Spacing, {}),
|
|
1349
1361
|
createComponent(ClassMethod, {
|
|
@@ -1462,6 +1474,7 @@ function SelectPromptDeclarations() {
|
|
|
1462
1474
|
createComponent(ClassMethod, {
|
|
1463
1475
|
doc: "A method to render the prompt",
|
|
1464
1476
|
name: "render",
|
|
1477
|
+
override: true,
|
|
1465
1478
|
"protected": true,
|
|
1466
1479
|
children: code`if (this.isInitial) {
|
|
1467
1480
|
this.output.write(cursor.hide);
|
|
@@ -1508,7 +1521,7 @@ function SelectPromptDeclarations() {
|
|
|
1508
1521
|
: this.cursor === index
|
|
1509
1522
|
? colors.bold(colors.underline(colors.text.prompt.input.active(this.options[index]!.label)))
|
|
1510
1523
|
: colors.text.prompt.input.inactive(this.options[index]!.label)
|
|
1511
|
-
} \${" ".repeat(spacing - this.options[index]!.label.length - (this.options[index]!.icon ? this.options[index]!.icon
|
|
1524
|
+
} \${" ".repeat(spacing - this.options[index]!.label.length - (this.options[index]!.icon ? this.options[index]!.icon!.length + 1 : 0))}\${
|
|
1512
1525
|
this.options[index]!.description && this.cursor === index
|
|
1513
1526
|
? colors.italic(colors.text.prompt.description.active(this.options[index]!.description))
|
|
1514
1527
|
: ""
|
|
@@ -1541,7 +1554,7 @@ function SelectPromptDeclarations() {
|
|
|
1541
1554
|
heading: "A function to create and run a select prompt, which returns a promise that resolves with the submitted value or rejects with a {@link CANCEL_SYMBOL | cancel symbol} if the prompt is cancelled.",
|
|
1542
1555
|
get children() {
|
|
1543
1556
|
return [
|
|
1544
|
-
createComponent(TSDocExample, { children: `import { select, isCancel } from "shell-shock
|
|
1557
|
+
createComponent(TSDocExample, { children: `import { select, isCancel } from "shell-shock:prompts";
|
|
1545
1558
|
|
|
1546
1559
|
async function run() {
|
|
1547
1560
|
const color = await select({
|
|
@@ -1649,6 +1662,7 @@ function NumericPromptDeclarations() {
|
|
|
1649
1662
|
createComponent(ClassField, {
|
|
1650
1663
|
name: "initialValue",
|
|
1651
1664
|
"protected": true,
|
|
1665
|
+
override: true,
|
|
1652
1666
|
type: "number",
|
|
1653
1667
|
children: code`0; `
|
|
1654
1668
|
}),
|
|
@@ -1743,6 +1757,7 @@ function NumericPromptDeclarations() {
|
|
|
1743
1757
|
createComponent(ClassMethod, {
|
|
1744
1758
|
doc: "A method to reset the prompt input",
|
|
1745
1759
|
name: "reset",
|
|
1760
|
+
override: true,
|
|
1746
1761
|
"protected": true,
|
|
1747
1762
|
children: code`super.reset();
|
|
1748
1763
|
this.currentInput = "";
|
|
@@ -1760,6 +1775,7 @@ function NumericPromptDeclarations() {
|
|
|
1760
1775
|
createComponent(ClassMethod, {
|
|
1761
1776
|
doc: "A method to handle keypress events and determine the corresponding action",
|
|
1762
1777
|
name: "keypress",
|
|
1778
|
+
override: true,
|
|
1763
1779
|
"protected": true,
|
|
1764
1780
|
parameters: [{
|
|
1765
1781
|
name: "char",
|
|
@@ -1869,7 +1885,7 @@ function NumericPromptDeclarations() {
|
|
|
1869
1885
|
heading: "A function to create and run a numeric prompt, which returns a promise that resolves with the submitted value or rejects with a {@link CANCEL_SYMBOL | cancel symbol} if the prompt is cancelled.",
|
|
1870
1886
|
get children() {
|
|
1871
1887
|
return [
|
|
1872
|
-
createComponent(TSDocExample, { children: `import { numeric, isCancel } from "shell-shock
|
|
1888
|
+
createComponent(TSDocExample, { children: `import { numeric, isCancel } from "shell-shock:prompts";
|
|
1873
1889
|
|
|
1874
1890
|
async function run() {
|
|
1875
1891
|
const age = await numeric({
|
|
@@ -1953,6 +1969,7 @@ function TogglePromptDeclarations() {
|
|
|
1953
1969
|
createComponent(ClassField, {
|
|
1954
1970
|
name: "initialValue",
|
|
1955
1971
|
"protected": true,
|
|
1972
|
+
override: true,
|
|
1956
1973
|
type: "boolean",
|
|
1957
1974
|
children: code`false; `
|
|
1958
1975
|
}),
|
|
@@ -2015,6 +2032,7 @@ function TogglePromptDeclarations() {
|
|
|
2015
2032
|
createComponent(ClassMethod, {
|
|
2016
2033
|
doc: "A method to handle keypress events and determine the corresponding action",
|
|
2017
2034
|
name: "keypress",
|
|
2035
|
+
override: true,
|
|
2018
2036
|
"protected": true,
|
|
2019
2037
|
parameters: [{
|
|
2020
2038
|
name: "char",
|
|
@@ -2098,7 +2116,7 @@ function TogglePromptDeclarations() {
|
|
|
2098
2116
|
heading: "A function to create and run a toggle prompt, which returns a promise that resolves with the submitted value or rejects with a {@link CANCEL_SYMBOL | cancel symbol} if the prompt is cancelled.",
|
|
2099
2117
|
get children() {
|
|
2100
2118
|
return [
|
|
2101
|
-
createComponent(TSDocExample, { children: `import { toggle, isCancel } from "shell-shock
|
|
2119
|
+
createComponent(TSDocExample, { children: `import { toggle, isCancel } from "shell-shock:prompts";
|
|
2102
2120
|
|
|
2103
2121
|
async function run() {
|
|
2104
2122
|
const likesIceCream = await toggle({
|
|
@@ -2170,7 +2188,7 @@ function PasswordPromptDeclaration() {
|
|
|
2170
2188
|
return [
|
|
2171
2189
|
createComponent(TSDocRemarks, { children: code`This function creates an instance of the TextPrompt class with the provided configuration options and a custom mask function to handle password input. It sets up event listeners for state updates, submission, and cancellation to handle the prompt interactions and return the appropriate results. The password prompt allows users to input text that is masked for privacy, making it suitable for scenarios like entering passwords or sensitive information.` }),
|
|
2172
2190
|
createComponent(Spacing, {}),
|
|
2173
|
-
createComponent(TSDocExample, { children: `import { password, isCancel } from "shell-shock
|
|
2191
|
+
createComponent(TSDocExample, { children: `import { password, isCancel } from "shell-shock:prompts";
|
|
2174
2192
|
|
|
2175
2193
|
async function run() {
|
|
2176
2194
|
const userPassword = await password({
|