@trenskow/reader 0.1.0 → 0.1.2
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 +3 -3
- package/lib/interview.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -41,7 +41,7 @@ const data = await interview({
|
|
|
41
41
|
// schema
|
|
42
42
|
'username': {
|
|
43
43
|
type: String,
|
|
44
|
-
|
|
44
|
+
label: 'Username',
|
|
45
45
|
description: 'Enter your username.',
|
|
46
46
|
type: String,
|
|
47
47
|
required: true,
|
|
@@ -49,7 +49,7 @@ const data = await interview({
|
|
|
49
49
|
},
|
|
50
50
|
'password': {
|
|
51
51
|
type: String,
|
|
52
|
-
|
|
52
|
+
label: 'Password',
|
|
53
53
|
description: 'Enter your password.',
|
|
54
54
|
type: String,
|
|
55
55
|
required: true,
|
|
@@ -78,7 +78,7 @@ In addition to the build-in validators of isvalid, the following is also support
|
|
|
78
78
|
|
|
79
79
|
| Name | Description | Type | Default value |
|
|
80
80
|
| ------------- | ----------------------------------------------------------- | :-------: | :-----------: |
|
|
81
|
-
| `
|
|
81
|
+
| `label` | The string to print before the user input. | `String` | |
|
|
82
82
|
| `description` | The string to print above the question. | `String` | |
|
|
83
83
|
| `silent` | Indicates if the property is private (does not echo input). | `Boolean` | `false` |
|
|
84
84
|
|
package/lib/interview.js
CHANGED
|
@@ -24,7 +24,7 @@ plugins.use(() => ({
|
|
|
24
24
|
formalize: (schema) => schema
|
|
25
25
|
}));
|
|
26
26
|
|
|
27
|
-
const interview = async (schema, { spacing = 0, input = process.stdin, output = process.stdout } = {}) => {
|
|
27
|
+
const interview = async (schema, { spacing = 0, input = process.stdin, output = process.stdout, strings = {} } = {}) => {
|
|
28
28
|
|
|
29
29
|
schema = formalize(schema);
|
|
30
30
|
|
|
@@ -84,7 +84,7 @@ const interview = async (schema, { spacing = 0, input = process.stdin, output =
|
|
|
84
84
|
print.tty.nn('\x1b[0m');
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
return await isvalid(await question(`${schema.label}${schema.required ?
|
|
87
|
+
return await isvalid(await question(`${schema.label}${schema.required ? ` ${strings?.required || 'required'}` : ''}: `, {
|
|
88
88
|
defaultValue: schema.default,
|
|
89
89
|
input,
|
|
90
90
|
output,
|