@reliverse/relinka 1.1.4 → 1.1.6

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 (118) hide show
  1. package/dist-npm/components/anykey/index.js +77 -57
  2. package/dist-npm/components/block/block.js +61 -48
  3. package/dist-npm/components/checkbox/index.js +211 -178
  4. package/dist-npm/components/confirm/confirm-main.js +122 -86
  5. package/dist-npm/components/confirm/confirm-three.js +27 -24
  6. package/dist-npm/components/confirm/index.js +45 -36
  7. package/dist-npm/components/core/Separator.js +17 -15
  8. package/dist-npm/components/core/create-prompt.js +124 -101
  9. package/dist-npm/components/core/errors.js +15 -19
  10. package/dist-npm/components/core/hook-engine.js +120 -91
  11. package/dist-npm/components/core/index.js +12 -12
  12. package/dist-npm/components/core/key.js +6 -16
  13. package/dist-npm/components/core/lines.js +54 -45
  14. package/dist-npm/components/core/make-theme.js +30 -21
  15. package/dist-npm/components/core/position.js +23 -27
  16. package/dist-npm/components/core/promise-polyfill.js +14 -11
  17. package/dist-npm/components/core/screen-manager.js +74 -59
  18. package/dist-npm/components/core/theme.js +32 -22
  19. package/dist-npm/components/core/use-effect.js +15 -9
  20. package/dist-npm/components/core/use-keypress.js +23 -19
  21. package/dist-npm/components/core/use-memo.js +16 -10
  22. package/dist-npm/components/core/use-pagination.js +32 -33
  23. package/dist-npm/components/core/use-prefix.js +38 -40
  24. package/dist-npm/components/core/use-ref.js +5 -2
  25. package/dist-npm/components/core/use-state.js +23 -15
  26. package/dist-npm/components/core/useKeyPress.js +17 -14
  27. package/dist-npm/components/core/usePromptState.js +14 -8
  28. package/dist-npm/components/core/utils.js +16 -7
  29. package/dist-npm/components/date/date.js +204 -168
  30. package/dist-npm/components/editor/index.js +92 -71
  31. package/dist-npm/components/expand/index.js +124 -96
  32. package/dist-npm/components/figures/index.js +294 -283
  33. package/dist-npm/components/input/index.js +87 -61
  34. package/dist-npm/components/input/text-main.js +124 -86
  35. package/dist-npm/components/input/text.js +28 -24
  36. package/dist-npm/components/instance/basic.js +25 -17
  37. package/dist-npm/components/instance/browser.js +18 -14
  38. package/dist-npm/components/instance/reporter/basic.js +65 -46
  39. package/dist-npm/components/instance/reporter/browser.js +47 -44
  40. package/dist-npm/components/instance/reporter/fancy.js +96 -83
  41. package/dist-npm/components/instance/shared.js +2 -2
  42. package/dist-npm/components/mono/mono.js +62 -52
  43. package/dist-npm/components/mono/monoTwo.js +49 -35
  44. package/dist-npm/components/multiselect/group-multiselect.js +71 -55
  45. package/dist-npm/components/multiselect/multi-select-two.js +130 -98
  46. package/dist-npm/components/multiselect/multi-select.js +49 -43
  47. package/dist-npm/components/multiselect/multiselect-main.js +146 -120
  48. package/dist-npm/components/multiselect/num-multi-select.js +130 -98
  49. package/dist-npm/components/multiselect/num-multiselect-main.js +35 -24
  50. package/dist-npm/components/next-steps/next-steps.js +25 -24
  51. package/dist-npm/components/number/index.js +112 -78
  52. package/dist-npm/components/number/number-main.js +2 -96
  53. package/dist-npm/components/password/index.js +73 -54
  54. package/dist-npm/components/password/password-main.js +2 -120
  55. package/dist-npm/components/password/password-three.js +30 -26
  56. package/dist-npm/components/progressbar/ProgressBar.js +64 -45
  57. package/dist-npm/components/progressbar/helper.js +40 -33
  58. package/dist-npm/components/progressbar/index.js +1 -1
  59. package/dist-npm/components/prompts/create.js +44 -29
  60. package/dist-npm/components/prompts/index.js +45 -45
  61. package/dist-npm/components/prompts/prompt.js +260 -211
  62. package/dist-npm/components/prompts/promptTwo.js +605 -561
  63. package/dist-npm/components/prompts/relinka.js +295 -237
  64. package/dist-npm/components/range/range.js +294 -247
  65. package/dist-npm/components/rawlist/index.js +107 -87
  66. package/dist-npm/components/results/results.js +37 -31
  67. package/dist-npm/components/search/index.js +193 -148
  68. package/dist-npm/components/select/index.js +186 -148
  69. package/dist-npm/components/select/num-select-main.js +27 -27
  70. package/dist-npm/components/select/num-select.js +5 -125
  71. package/dist-npm/components/select/select-key.js +25 -24
  72. package/dist-npm/components/select/select-main.js +133 -109
  73. package/dist-npm/components/select/select-three.js +36 -32
  74. package/dist-npm/components/select/select-two.js +87 -95
  75. package/dist-npm/components/spinner/index.js +136 -107
  76. package/dist-npm/components/st-end/end.d.ts +1 -1
  77. package/dist-npm/components/st-end/end.js +26 -35
  78. package/dist-npm/components/st-end/start.d.ts +1 -1
  79. package/dist-npm/components/st-end/start.js +15 -30
  80. package/dist-npm/components/toggle/index.js +137 -113
  81. package/dist-npm/components/visual/animate/animate.js +10 -53
  82. package/dist-npm/components/visual/ascii-art/ascii-art.js +1 -12
  83. package/dist-npm/mod.js +2 -1
  84. package/dist-npm/testing/index.js +83 -58
  85. package/dist-npm/types/general.d.ts +2 -1
  86. package/dist-npm/types/general.js +1 -0
  87. package/dist-npm/types/index.js +3 -2
  88. package/dist-npm/types/keypress.js +36 -35
  89. package/dist-npm/types/readline.js +1 -0
  90. package/dist-npm/types/relinka.js +1 -0
  91. package/dist-npm/types/utils.js +1 -0
  92. package/dist-npm/utils/box.js +137 -135
  93. package/dist-npm/utils/color.js +74 -65
  94. package/dist-npm/utils/colorize.js +156 -124
  95. package/dist-npm/utils/component.js +657 -532
  96. package/dist-npm/utils/constants.js +63 -64
  97. package/dist-npm/utils/core.js +3 -2
  98. package/dist-npm/utils/decoder.js +223 -244
  99. package/dist-npm/utils/error.js +9 -4
  100. package/dist-npm/utils/errors.js +4 -14
  101. package/dist-npm/utils/format.js +24 -19
  102. package/dist-npm/utils/keypress.js +414 -316
  103. package/dist-npm/utils/log.js +15 -11
  104. package/dist-npm/utils/mapping.js +52 -45
  105. package/dist-npm/utils/messages.js +183 -183
  106. package/dist-npm/utils/platforms.js +20 -16
  107. package/dist-npm/utils/prompt-tmp.js +286 -235
  108. package/dist-npm/utils/prompt-two.js +286 -235
  109. package/dist-npm/utils/readline.js +7 -5
  110. package/dist-npm/utils/skeleton.js +170 -130
  111. package/dist-npm/utils/stream.js +2 -2
  112. package/dist-npm/utils/string.js +58 -44
  113. package/dist-npm/utils/terminal.js +34 -23
  114. package/dist-npm/utils/tree.js +41 -30
  115. package/dist-npm/utils/types.js +1 -0
  116. package/dist-npm/utils/utils.js +8 -8
  117. package/dist-npm/utils/variants.js +44 -36
  118. package/package.json +20 -28
@@ -1,191 +1,227 @@
1
- import { Type } from "@sinclair/typebox";
2
- import { Value } from "@sinclair/typebox/value";
3
- import { stdin as input, stdout as output } from "node:process";
4
- import readline from "node:readline/promises";
1
+ import {Type} from '@sinclair/typebox';
2
+ import {Value} from '@sinclair/typebox/value';
5
3
  import {
6
- buildRegExp,
7
- digit,
8
- endOfString,
9
- repeat,
10
- startOfString
11
- } from "ts-regex-builder";
12
- import { fmt, msg } from "../../utils/messages.js";
4
+ stdin as input,
5
+ stdout as output,
6
+ } from 'node:process';
7
+ import readline from 'node:readline/promises';
13
8
  import {
14
- countLines,
15
- deleteLastLine,
16
- deleteLastLines
17
- } from "../../utils/terminal.js";
9
+ buildRegExp,
10
+ digit,
11
+ endOfString,
12
+ repeat,
13
+ startOfString,
14
+ } from 'ts-regex-builder';
15
+ import {fmt, msg} from '../../utils/messages.js';
16
+ import {
17
+ countLines,
18
+ deleteLastLine,
19
+ deleteLastLines,
20
+ } from '../../utils/terminal.js';
21
+
22
+ const isString = (a) => typeof a === 'string';
23
+
18
24
  const twoDigits = repeat(digit, 2);
19
25
  const fourDigits = repeat(digit, 4);
20
- const separatorDot = ".";
21
- const separatorSlash = "/";
26
+ const separatorDot = '.';
27
+ const separatorSlash = '/';
28
+
22
29
  const regexDDMMYYYY = buildRegExp([
23
- startOfString,
24
- twoDigits,
25
-
26
- separatorDot,
27
- twoDigits,
28
-
29
- separatorDot,
30
- fourDigits,
31
-
32
- endOfString
30
+ startOfString,
31
+ twoDigits,
32
+ separatorDot,
33
+ twoDigits,
34
+ separatorDot,
35
+ fourDigits,
36
+ endOfString,
33
37
  ]);
38
+
34
39
  const regexMMDDYYYY = buildRegExp([
35
- startOfString,
36
- twoDigits,
37
-
38
- separatorSlash,
39
- twoDigits,
40
-
41
- separatorSlash,
42
- fourDigits,
43
-
44
- endOfString
40
+ startOfString,
41
+ twoDigits,
42
+ separatorSlash,
43
+ twoDigits,
44
+ separatorSlash,
45
+ fourDigits,
46
+ endOfString,
45
47
  ]);
48
+
46
49
  const regexYYYYMMDD = buildRegExp([
47
- startOfString,
48
- fourDigits,
49
-
50
- separatorDot,
51
- twoDigits,
52
-
53
- separatorDot,
54
- twoDigits,
55
-
56
- endOfString
50
+ startOfString,
51
+ fourDigits,
52
+ separatorDot,
53
+ twoDigits,
54
+ separatorDot,
55
+ twoDigits,
56
+ endOfString,
57
57
  ]);
58
+
58
59
  const dateFormatSchema = Type.Union([
59
- Type.RegExp(regexDDMMYYYY, { description: "DD.MM.YYYY" }),
60
- Type.RegExp(regexMMDDYYYY, { description: "MM/DD/YYYY" }),
61
- Type.RegExp(regexYYYYMMDD, { description: "YYYY.MM.DD" })
60
+ Type.RegExp(regexDDMMYYYY, {
61
+ description: 'DD.MM.YYYY',
62
+ }),
63
+ Type.RegExp(regexMMDDYYYY, {
64
+ description: 'MM/DD/YYYY',
65
+ }),
66
+ Type.RegExp(regexYYYYMMDD, {
67
+ description: 'YYYY.MM.DD',
68
+ }),
62
69
  ]);
70
+
63
71
  export async function datePrompt(options) {
64
- const {
65
- title,
66
- dateFormat,
67
- dateKind,
68
- hint,
69
- validate,
70
- defaultValue,
71
- schema,
72
- titleColor = "cyanBright",
73
- answerColor = "none",
74
- titleTypography = "bold",
75
- titleVariant,
76
- content,
77
- contentColor,
78
- contentTypography,
79
- contentVariant,
80
- borderColor = "viceGradient",
81
- variantOptions
82
- } = options;
83
- const rl = readline.createInterface({ input, output });
84
- let linesToDelete = 0;
85
- let errorMessage = "";
86
- try {
87
- while (true) {
88
- if (linesToDelete > 0) {
89
- deleteLastLines(linesToDelete);
90
- }
91
- const questionText = fmt({
92
- type: errorMessage !== "" ? "M_ERROR" : "M_GENERAL",
93
- title: `${title} [Format: ${dateFormat}]`,
94
- titleColor,
95
- titleTypography,
72
+ const {
73
+ title,
74
+ dateFormat,
75
+ dateKind,
76
+ hint,
77
+ validate,
78
+ defaultValue,
79
+ schema,
80
+ titleColor = 'cyanBright',
81
+ titleTypography = 'bold',
96
82
  titleVariant,
97
83
  content,
98
84
  contentColor,
99
85
  contentTypography,
100
86
  contentVariant,
101
- borderColor,
102
- hint,
87
+ borderColor = 'viceGradient',
103
88
  variantOptions,
104
- errorMessage,
105
- addNewLineBefore: false
106
- });
107
- const questionLines = countLines(questionText);
108
- linesToDelete = questionLines + 1;
109
- msg({ type: "M_GENERAL", title: questionText });
110
- const answer = (await rl.question("> ")).trim() || defaultValue;
111
- if (answer === defaultValue && defaultValue) {
112
- deleteLastLine();
113
- msg({
114
- type: "M_MIDDLE",
115
- title: ` ${defaultValue}`,
116
- titleColor: answerColor
117
- });
118
- }
119
- if (!Value.Check(dateFormatSchema, answer)) {
120
- errorMessage = `Please enter a valid date in ${dateFormat} format.`;
121
- msg({ type: "M_ERROR", title: errorMessage });
122
- continue;
123
- }
124
- let matchedFormat = null;
125
- if (regexDDMMYYYY.test(answer)) {
126
- matchedFormat = "DD.MM.YYYY";
127
- } else if (regexMMDDYYYY.test(answer)) {
128
- matchedFormat = "MM/DD/YYYY";
129
- } else if (regexYYYYMMDD.test(answer)) {
130
- matchedFormat = "YYYY.MM.DD";
131
- }
132
- if (dateKind === "birthday" && matchedFormat) {
133
- const parts = answer.split(/[./-]/);
134
- let date;
135
- if (matchedFormat === "DD.MM.YYYY") {
136
- date = new Date(
137
- Number(parts[2]),
138
- Number(parts[1]) - 1,
139
- Number(parts[0])
140
- );
141
- } else if (matchedFormat === "MM/DD/YYYY") {
142
- date = new Date(
143
- Number(parts[2]),
144
- Number(parts[0]) - 1,
145
- Number(parts[1])
146
- );
147
- } else if (matchedFormat === "YYYY.MM.DD") {
148
- date = new Date(
149
- Number(parts[0]),
150
- Number(parts[1]) - 1,
151
- Number(parts[2])
152
- );
153
- } else {
154
- date = new Date(answer);
155
- }
156
- if (isNaN(date.getTime()) || date.getFullYear() < 1900 || date > new Date()) {
157
- errorMessage = "Please enter a valid birthday date (e.g., 14.09.1999).";
158
- msg({ type: "M_ERROR", title: errorMessage });
159
- continue;
160
- }
161
- }
162
- let isValid = true;
163
- errorMessage = "";
164
- if (schema) {
165
- isValid = Value.Check(schema, answer);
166
- if (!isValid) {
167
- const errors = [...Value.Errors(schema, answer)];
168
- errorMessage = errors[0]?.message ?? "Invalid input.";
169
- msg({ type: "M_ERROR", title: errorMessage });
170
- continue;
171
- }
172
- }
173
- if (validate && isValid) {
174
- const validation = await validate(answer);
175
- if (validation !== true) {
176
- isValid = false;
177
- errorMessage = typeof validation === "string" ? validation : "Invalid input.";
178
- msg({ type: "M_ERROR", title: errorMessage });
179
- continue;
89
+ } = options;
90
+
91
+ const rl = readline.createInterface({
92
+ input,
93
+ output,
94
+ });
95
+ let linesToDelete = 0;
96
+ let errorMessage = '';
97
+
98
+ try {
99
+ while (true) {
100
+ if (linesToDelete > 0) {
101
+ deleteLastLines(linesToDelete);
102
+ }
103
+
104
+ const questionText = fmt({
105
+ type: errorMessage !== '' ? 'M_ERROR' : 'M_GENERAL',
106
+ title: `${title} [Format: ${dateFormat}]`,
107
+ titleColor,
108
+ titleTypography,
109
+ titleVariant,
110
+ content,
111
+ contentColor,
112
+ contentTypography,
113
+ contentVariant,
114
+ borderColor,
115
+ hint,
116
+ variantOptions,
117
+ errorMessage,
118
+ addNewLineBefore: false,
119
+ });
120
+
121
+ const questionLines = countLines(questionText);
122
+
123
+ linesToDelete = questionLines + 1;
124
+ msg({
125
+ type: 'M_GENERAL',
126
+ title: questionText,
127
+ });
128
+ const answer = (await rl.question('> ')).trim() || defaultValue;
129
+
130
+ if (answer === defaultValue && defaultValue) {
131
+ deleteLastLine();
132
+ msg({
133
+ type: 'M_MIDDLE',
134
+ title: ` ${defaultValue}`,
135
+ titleColor: 'none',
136
+ });
137
+ }
138
+
139
+ if (!Value.Check(dateFormatSchema, answer)) {
140
+ errorMessage = `Please enter a valid date in ${dateFormat} format.`;
141
+ msg({
142
+ type: 'M_ERROR',
143
+ title: errorMessage,
144
+ });
145
+ continue;
146
+ }
147
+
148
+ let matchedFormat = null;
149
+
150
+ if (regexDDMMYYYY.test(answer)) {
151
+ matchedFormat = 'DD.MM.YYYY';
152
+ } else if (regexMMDDYYYY.test(answer)) {
153
+ matchedFormat = 'MM/DD/YYYY';
154
+ } else if (regexYYYYMMDD.test(answer)) {
155
+ matchedFormat = 'YYYY.MM.DD';
156
+ }
157
+
158
+
159
+ if (dateKind === 'birthday' && matchedFormat) {
160
+ const parts = answer.split(/[./-]/);
161
+ let date;
162
+
163
+ if (matchedFormat === 'DD.MM.YYYY') {
164
+ date = new Date(Number(parts[2]), Number(parts[1]) - 1, Number(parts[0]));
165
+ } else if (matchedFormat === 'MM/DD/YYYY') {
166
+ date = new Date(Number(parts[2]), Number(parts[0]) - 1, Number(parts[1]));
167
+ } else if (matchedFormat === 'YYYY.MM.DD') {
168
+ date = new Date(Number(parts[0]), Number(parts[1]) - 1, Number(parts[2]));
169
+ } else {
170
+ date = new Date(answer);
171
+ }
172
+
173
+
174
+ if (isNaN(date.getTime()) || date.getFullYear() < 1900 || date > new Date()) {
175
+ errorMessage = 'Please enter a valid birthday date (e.g., 14.09.1999).';
176
+ msg({
177
+ type: 'M_ERROR',
178
+ title: errorMessage,
179
+ });
180
+ continue;
181
+ }
182
+ }
183
+
184
+ let isValid = true;
185
+
186
+ errorMessage = '';
187
+ if (schema) {
188
+ isValid = Value.Check(schema, answer);
189
+ if (!isValid) {
190
+ const errors = Value.Errors(schema, answer);
191
+
192
+ errorMessage = errors[0]?.message ?? 'Invalid input.';
193
+ msg({
194
+ type: 'M_ERROR',
195
+ title: errorMessage,
196
+ });
197
+ continue;
198
+ }
199
+ }
200
+
201
+ if (validate && isValid) {
202
+ const validation = await validate(answer);
203
+
204
+ if (!validation) {
205
+ isValid = false;
206
+ errorMessage = isString(validation) ? validation : 'Invalid input.';
207
+ msg({
208
+ type: 'M_ERROR',
209
+ title: errorMessage,
210
+ });
211
+ continue;
212
+ }
213
+ }
214
+
215
+ if (isValid) {
216
+ msg({
217
+ type: 'M_NEWLINE',
218
+ title: '',
219
+ });
220
+ rl.close();
221
+ return answer;
222
+ }
180
223
  }
181
- }
182
- if (isValid) {
183
- msg({ type: "M_NEWLINE", title: "" });
224
+ } finally {
184
225
  rl.close();
185
- return answer;
186
- }
187
226
  }
188
- } finally {
189
- rl.close();
190
- }
191
227
  }
@@ -1,78 +1,99 @@
1
- import { editAsync } from "external-editor";
2
- import { AsyncResource } from "node:async_hooks";
1
+ import {editAsync} from 'external-editor';
2
+ import {AsyncResource} from 'node:async_hooks';
3
3
  import {
4
- createPrompt,
5
- useEffect,
6
- useState,
7
- useKeypress,
8
- usePrefix,
9
- isEnterKey,
10
- makeTheme
11
- } from "../../components/core/index.js";
4
+ createPrompt,
5
+ useEffect,
6
+ useState,
7
+ useKeypress,
8
+ usePrefix,
9
+ isEnterKey,
10
+ makeTheme,
11
+ } from '../../components/core/index.js';
12
+
12
13
  export default createPrompt((config, done) => {
13
- const {
14
- waitForUseInput = true,
15
- file: { postfix = config.postfix ?? ".txt", ...fileProps } = {},
16
- validate = () => true
17
- } = config;
18
- const theme = makeTheme(config.theme);
19
- const [status, setStatus] = useState("idle");
20
- const [value, setValue] = useState(config.default || "");
21
- const [errorMsg, setError] = useState();
22
- const prefix = usePrefix({ status, theme });
23
- function startEditor(rl) {
24
- rl.pause();
25
- const editCallback = AsyncResource.bind(
26
- async (error2, answer) => {
27
- rl.resume();
28
- if (error2) {
29
- setError(error2.toString());
30
- } else {
31
- setStatus("loading");
32
- const isValid = await validate(answer);
33
- if (isValid === true) {
34
- setError(void 0);
35
- setStatus("done");
36
- done(answer);
37
- } else {
38
- setValue(answer);
39
- setError(isValid || "You must provide a valid value");
40
- setStatus("idle");
41
- }
42
- }
43
- }
44
- );
45
- editAsync(value, (error2, answer) => void editCallback(error2, answer), {
46
- postfix,
47
- ...fileProps
14
+ const {
15
+ waitForUseInput = true,
16
+ file: {postfix = config.postfix ?? '.txt', ...fileProps} = {},
17
+ validate = () => true,
18
+ } = config;
19
+
20
+ const theme = makeTheme(config.theme);
21
+ const [status, setStatus] = useState('idle');
22
+ const [value, setValue] = useState(config.default || '');
23
+ const [errorMsg, setError] = useState();
24
+ const prefix = usePrefix({
25
+ status,
26
+ theme,
48
27
  });
49
- }
50
- useEffect((rl) => {
51
- if (!waitForUseInput) {
52
- startEditor(rl);
28
+
29
+ function startEditor(rl) {
30
+ rl.pause();
31
+ const editCallback = AsyncResource.bind(async (error2, answer) => {
32
+ rl.resume();
33
+ if (error2) {
34
+ setError(error2.toString());
35
+ } else {
36
+ setStatus('loading');
37
+ const isValid = await validate(answer);
38
+
39
+ if (isValid) {
40
+ setError(void 0);
41
+ setStatus('done');
42
+ done(answer);
43
+ } else {
44
+ setValue(answer);
45
+ setError(isValid || 'You must provide a valid value');
46
+ setStatus('idle');
47
+ }
48
+ }
49
+ });
50
+
51
+ editAsync(value, (error2, answer) => void editCallback(error2, answer), {
52
+ postfix,
53
+ ...fileProps,
54
+ });
53
55
  }
54
- }, []);
55
- useKeypress((key, rl) => {
56
- if (status !== "idle") {
57
- return;
56
+
57
+ useEffect((rl) => {
58
+ if (!waitForUseInput) {
59
+ startEditor(rl);
60
+ }
61
+ }, []);
62
+ useKeypress((key, rl) => {
63
+ if (status !== 'idle') {
64
+ return;
65
+ }
66
+
67
+ if (isEnterKey(key)) {
68
+ startEditor(rl);
69
+ }
70
+ });
71
+ const message = theme.style.message(config.message, status);
72
+ let helpTip = '';
73
+
74
+ if (status === 'loading') {
75
+ helpTip = theme.style.help('Received');
76
+ } else if (status === 'idle') {
77
+ const enterKey = theme.style.key('enter');
78
+
79
+ helpTip = theme.style.help(`Press ${enterKey} to launch your preferred editor.`);
58
80
  }
59
- if (isEnterKey(key)) {
60
- startEditor(rl);
81
+
82
+
83
+ let error = '';
84
+
85
+ if (errorMsg) {
86
+ error = theme.style.error(errorMsg);
61
87
  }
62
- });
63
- const message = theme.style.message(config.message, status);
64
- let helpTip = "";
65
- if (status === "loading") {
66
- helpTip = theme.style.help("Received");
67
- } else if (status === "idle") {
68
- const enterKey = theme.style.key("enter");
69
- helpTip = theme.style.help(
70
- `Press ${enterKey} to launch your preferred editor.`
71
- );
72
- }
73
- let error = "";
74
- if (errorMsg) {
75
- error = theme.style.error(errorMsg);
76
- }
77
- return [[prefix, message, helpTip].filter(Boolean).join(" "), error];
88
+
89
+ return [
90
+ [
91
+ prefix,
92
+ message,
93
+ helpTip,
94
+ ]
95
+ .filter(Boolean)
96
+ .join(' '),
97
+ error,
98
+ ];
78
99
  });