@reliverse/relinka 1.1.8 → 1.1.9

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.
@@ -107,7 +107,10 @@ export async function datePrompt(options) {
107
107
  });
108
108
  const questionLines = countLines(questionText);
109
109
  linesToDelete = questionLines + 1;
110
- msg({ type: errorMessage !== "" ? "M_ERROR" : "M_GENERAL", title: questionText });
110
+ msg({
111
+ type: errorMessage !== "" ? "M_ERROR" : "M_GENERAL",
112
+ title: questionText
113
+ });
111
114
  deleteLastLine();
112
115
  deleteLastLine();
113
116
  const answer = (await rl.question(`${cyanBright(">")} `)).trim() || defaultValue;
@@ -165,6 +168,10 @@ export async function datePrompt(options) {
165
168
  }
166
169
  }
167
170
  let isValid = true;
171
+ let gotError = false;
172
+ if (errorMessage !== "") {
173
+ gotError = true;
174
+ }
168
175
  errorMessage = "";
169
176
  if (schema) {
170
177
  isValid = Value.Check(schema, answer);
@@ -172,6 +179,7 @@ export async function datePrompt(options) {
172
179
  const errors = [...Value.Errors(schema, answer)];
173
180
  errorMessage = errors[0]?.message ?? "Invalid input.";
174
181
  msg({ type: "M_ERROR", title: errorMessage });
182
+ gotError = true;
175
183
  continue;
176
184
  }
177
185
  }
@@ -181,10 +189,16 @@ export async function datePrompt(options) {
181
189
  isValid = false;
182
190
  errorMessage = typeof validation === "string" ? validation : "Invalid input.";
183
191
  msg({ type: "M_ERROR", title: errorMessage });
192
+ gotError = true;
184
193
  continue;
185
194
  }
186
195
  }
187
196
  if (isValid) {
197
+ if (gotError) {
198
+ deleteLastLine();
199
+ deleteLastLine();
200
+ msg({ type: "M_MIDDLE", title: ` ${answer}` });
201
+ }
188
202
  msg({ type: "M_NEWLINE", title: "" });
189
203
  rl.close();
190
204
  return answer;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reliverse/relinka",
3
- "version": "1.1.8",
3
+ "version": "1.1.9",
4
4
  "type": "module",
5
5
  "description": "@reliverse/relinka is a powerful library that enables seamless, typesafe, and resilient prompts for command-line applications. Crafted with simplicity and elegance, it provides developers with an intuitive and robust way to build interactive CLIs.",
6
6
  "scripts": {