@twin.org/cli-core 0.0.1-next.9 → 0.0.2-next.10

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.
@@ -4,13 +4,13 @@ Display utilities for the CLI.
4
4
 
5
5
  ## Constructors
6
6
 
7
- ### new CLIDisplay()
7
+ ### Constructor
8
8
 
9
- > **new CLIDisplay**(): [`CLIDisplay`](CLIDisplay.md)
9
+ > **new CLIDisplay**(): `CLIDisplay`
10
10
 
11
11
  #### Returns
12
12
 
13
- [`CLIDisplay`](CLIDisplay.md)
13
+ `CLIDisplay`
14
14
 
15
15
  ## Properties
16
16
 
@@ -22,10 +22,12 @@ The default output method for writing standard messages.
22
22
 
23
23
  #### Parameters
24
24
 
25
- **buffer**: `string` \| `Uint8Array`
25
+ ##### buffer
26
26
 
27
27
  The message to output.
28
28
 
29
+ `string` | `Uint8Array`\<`ArrayBufferLike`\>
30
+
29
31
  #### Returns
30
32
 
31
33
  `void`
@@ -40,10 +42,12 @@ The default output method for writing error messages.
40
42
 
41
43
  #### Parameters
42
44
 
43
- **buffer**: `string` \| `Uint8Array`
45
+ ##### buffer
44
46
 
45
47
  The message to output.
46
48
 
49
+ `string` | `Uint8Array`\<`ArrayBufferLike`\>
50
+
47
51
  #### Returns
48
52
 
49
53
  `void`
@@ -70,15 +74,21 @@ Display the header for the CLI.
70
74
 
71
75
  #### Parameters
72
76
 
73
- **title**: `string`
77
+ ##### title
78
+
79
+ `string`
74
80
 
75
81
  The title of the CLI.
76
82
 
77
- **version**: `string`
83
+ ##### version
84
+
85
+ `string`
78
86
 
79
87
  The version of the CLI.
80
88
 
81
- **icon**: `string`
89
+ ##### icon
90
+
91
+ `string`
82
92
 
83
93
  The icon for the CLI.
84
94
 
@@ -96,11 +106,15 @@ Display an error message.
96
106
 
97
107
  #### Parameters
98
108
 
99
- **error**: `unknown`
109
+ ##### error
110
+
111
+ `unknown`
100
112
 
101
113
  The error to display.
102
114
 
103
- **lineBreaks**: `boolean` = `true`
115
+ ##### lineBreaks
116
+
117
+ `boolean` = `true`
104
118
 
105
119
  Whether to add a line break after the error.
106
120
 
@@ -118,7 +132,9 @@ Display a section.
118
132
 
119
133
  #### Parameters
120
134
 
121
- **label**: `string`
135
+ ##### label
136
+
137
+ `string`
122
138
 
123
139
  The label for the section.
124
140
 
@@ -136,15 +152,21 @@ Display a value with a label.
136
152
 
137
153
  #### Parameters
138
154
 
139
- **label**: `string`
155
+ ##### label
156
+
157
+ `string`
140
158
 
141
159
  The label for the value.
142
160
 
143
- **value**: `unknown`
161
+ ##### value
162
+
163
+ `unknown`
144
164
 
145
165
  The value to display.
146
166
 
147
- **indentLevel**: `number` = `0`
167
+ ##### indentLevel
168
+
169
+ `number` = `0`
148
170
 
149
171
  The level of indentation.
150
172
 
@@ -156,17 +178,21 @@ The level of indentation.
156
178
 
157
179
  ### task()
158
180
 
159
- > `static` **task**(`label`, `task`?): `void`
181
+ > `static` **task**(`label`, `task?`): `void`
160
182
 
161
183
  Display a task with a label.
162
184
 
163
185
  #### Parameters
164
186
 
165
- **label**: `string`
187
+ ##### label
188
+
189
+ `string`
166
190
 
167
191
  The label for the value.
168
192
 
169
- **task?**: `string`
193
+ ##### task?
194
+
195
+ `string`
170
196
 
171
197
  The task to display.
172
198
 
@@ -196,7 +222,9 @@ Display formatted and colorized JSON.
196
222
 
197
223
  #### Parameters
198
224
 
199
- **obj**: `unknown`
225
+ ##### obj
226
+
227
+ `unknown`
200
228
 
201
229
  The object to display.
202
230
 
@@ -206,6 +234,26 @@ The object to display.
206
234
 
207
235
  ***
208
236
 
237
+ ### warning()
238
+
239
+ > `static` **warning**(`label`): `void`
240
+
241
+ Display a warning.
242
+
243
+ #### Parameters
244
+
245
+ ##### label
246
+
247
+ `string`
248
+
249
+ The label for the warning.
250
+
251
+ #### Returns
252
+
253
+ `void`
254
+
255
+ ***
256
+
209
257
  ### done()
210
258
 
211
259
  > `static` **done**(): `void`
@@ -226,15 +274,21 @@ Start the spinner.
226
274
 
227
275
  #### Parameters
228
276
 
229
- **i18nMessage**: `string` = `"cli.progress.pleaseWait"`
277
+ ##### i18nMessage
278
+
279
+ `string` = `"cli.progress.pleaseWait"`
230
280
 
231
281
  The message to display with the spinner.
232
282
 
233
- **spinnerCharacters**: `string`[] = `...`
283
+ ##### spinnerCharacters
284
+
285
+ `string`[] = `...`
234
286
 
235
287
  The characters to use in the spinner.
236
288
 
237
- **interval**: `number` = `100`
289
+ ##### interval
290
+
291
+ `number` = `100`
238
292
 
239
293
  The interval for the spinner.
240
294
 
@@ -4,13 +4,13 @@ Utilities for getting standard options.
4
4
 
5
5
  ## Constructors
6
6
 
7
- ### new CLIOptions()
7
+ ### Constructor
8
8
 
9
- > **new CLIOptions**(): [`CLIOptions`](CLIOptions.md)
9
+ > **new CLIOptions**(): `CLIOptions`
10
10
 
11
11
  #### Returns
12
12
 
13
- [`CLIOptions`](CLIOptions.md)
13
+ `CLIOptions`
14
14
 
15
15
  ## Methods
16
16
 
@@ -22,31 +22,43 @@ Get the options for output.
22
22
 
23
23
  #### Parameters
24
24
 
25
- **command**: `Command`
25
+ ##### command
26
+
27
+ `Command`
26
28
 
27
29
  The command to add the options to.
28
30
 
29
- **opts**
31
+ ##### opts
30
32
 
31
33
  The options of what to include.
32
34
 
33
- **opts.noConsole**: `boolean`
35
+ ###### noConsole
36
+
37
+ `boolean`
34
38
 
35
39
  Do not output to the console.
36
40
 
37
- **opts.json**: `boolean`
41
+ ###### json
42
+
43
+ `boolean`
38
44
 
39
45
  Output to a JSON file.
40
46
 
41
- **opts.env**: `boolean`
47
+ ###### env
48
+
49
+ `boolean`
42
50
 
43
51
  Output to an environment file.
44
52
 
45
- **opts.mergeJson**: `boolean`
53
+ ###### mergeJson
54
+
55
+ `boolean`
46
56
 
47
57
  Merge existing JSON file.
48
58
 
49
- **opts.mergeEnv**: `boolean`
59
+ ###### mergeEnv
60
+
61
+ `boolean`
50
62
 
51
63
  Merge existing environment file.
52
64
 
@@ -4,13 +4,13 @@ Parameter utilities for the CLI.
4
4
 
5
5
  ## Constructors
6
6
 
7
- ### new CLIParam()
7
+ ### Constructor
8
8
 
9
- > **new CLIParam**(): [`CLIParam`](CLIParam.md)
9
+ > **new CLIParam**(): `CLIParam`
10
10
 
11
11
  #### Returns
12
12
 
13
- [`CLIParam`](CLIParam.md)
13
+ `CLIParam`
14
14
 
15
15
  ## Methods
16
16
 
@@ -22,15 +22,21 @@ Check the option to see if it exists.
22
22
 
23
23
  #### Parameters
24
24
 
25
- **optionName**: `string`
25
+ ##### optionName
26
+
27
+ `string`
26
28
 
27
29
  The name of the option.
28
30
 
29
- **optionValue**: `undefined` \| `string`
31
+ ##### optionValue
30
32
 
31
33
  The option value.
32
34
 
33
- **allowEnvVar**: `boolean`
35
+ `undefined` | `string`
36
+
37
+ ##### allowEnvVar
38
+
39
+ `boolean`
34
40
 
35
41
  Allow the option to be read from an env var.
36
42
 
@@ -50,19 +56,25 @@ An error if the option is invalid.
50
56
 
51
57
  > `static` **stringValue**(`optionName`, `optionValue`, `allowEnvVar`): `string`
52
58
 
53
- Check the option to see if it exists.
59
+ Check the option to see if the String exists.
54
60
 
55
61
  #### Parameters
56
62
 
57
- **optionName**: `string`
63
+ ##### optionName
64
+
65
+ `string`
58
66
 
59
67
  The name of the option.
60
68
 
61
- **optionValue**: `undefined` \| `string`
69
+ ##### optionValue
62
70
 
63
71
  The option value.
64
72
 
65
- • **allowEnvVar**: `boolean` = `true`
73
+ `undefined` | `string`
74
+
75
+ ##### allowEnvVar
76
+
77
+ `boolean` = `true`
66
78
 
67
79
  Allow the option to be read from an env var.
68
80
 
@@ -78,23 +90,79 @@ An error if the option is invalid.
78
90
 
79
91
  ***
80
92
 
93
+ ### arrayOneOf()
94
+
95
+ > `static` **arrayOneOf**\<`T`\>(`optionName`, `optionValue`, `validValues`, `allowEnvVar`): `T`
96
+
97
+ Check the option to see if the value exists in the specific array.
98
+
99
+ #### Type Parameters
100
+
101
+ ##### T
102
+
103
+ `T` = `string`
104
+
105
+ #### Parameters
106
+
107
+ ##### optionName
108
+
109
+ `string`
110
+
111
+ The name of the option.
112
+
113
+ ##### optionValue
114
+
115
+ The option value.
116
+
117
+ `undefined` | `string`
118
+
119
+ ##### validValues
120
+
121
+ `T`[]
122
+
123
+ The valid values.
124
+
125
+ ##### allowEnvVar
126
+
127
+ `boolean` = `true`
128
+
129
+ Allow the option to be read from an env var.
130
+
131
+ #### Returns
132
+
133
+ `T`
134
+
135
+ The final option value.
136
+
137
+ #### Throws
138
+
139
+ An error if the option is invalid.
140
+
141
+ ***
142
+
81
143
  ### url()
82
144
 
83
145
  > `static` **url**(`optionName`, `optionValue`, `allowEnvVar`): `string`
84
146
 
85
- Check the option to see if it a url.
147
+ Check the option to see if it is a url.
86
148
 
87
149
  #### Parameters
88
150
 
89
- **optionName**: `string`
151
+ ##### optionName
152
+
153
+ `string`
90
154
 
91
155
  The name of the option.
92
156
 
93
- **optionValue**: `undefined` \| `string`
157
+ ##### optionValue
94
158
 
95
159
  The option value.
96
160
 
97
- • **allowEnvVar**: `boolean` = `true`
161
+ `undefined` | `string`
162
+
163
+ ##### allowEnvVar
164
+
165
+ `boolean` = `true`
98
166
 
99
167
  Allow the option to be read from an env var.
100
168
 
@@ -112,29 +180,39 @@ An error if the option is invalid.
112
180
 
113
181
  ### number()
114
182
 
115
- > `static` **number**(`optionName`, `optionValue`, `allowEnvVar`, `minValue`, `maxValue`?): `number`
183
+ > `static` **number**(`optionName`, `optionValue`, `allowEnvVar`, `minValue`, `maxValue?`): `number`
116
184
 
117
185
  Check the option to see if it exists and is a number.
118
186
 
119
187
  #### Parameters
120
188
 
121
- **optionName**: `string`
189
+ ##### optionName
190
+
191
+ `string`
122
192
 
123
193
  The name of the option.
124
194
 
125
- **optionValue**: `undefined` \| `string`
195
+ ##### optionValue
126
196
 
127
197
  The option value.
128
198
 
129
- • **allowEnvVar**: `boolean` = `true`
199
+ `undefined` | `string`
200
+
201
+ ##### allowEnvVar
202
+
203
+ `boolean` = `true`
130
204
 
131
205
  Allow the option to be read from an env var.
132
206
 
133
- **minValue**: `number` = `0`
207
+ ##### minValue
208
+
209
+ `number` = `0`
134
210
 
135
211
  The minimum value.
136
212
 
137
- **maxValue?**: `number`
213
+ ##### maxValue?
214
+
215
+ `number`
138
216
 
139
217
  The maximum value.
140
218
 
@@ -152,29 +230,39 @@ An error if the option is invalid.
152
230
 
153
231
  ### integer()
154
232
 
155
- > `static` **integer**(`optionName`, `optionValue`, `allowEnvVar`, `minValue`, `maxValue`?): `number`
233
+ > `static` **integer**(`optionName`, `optionValue`, `allowEnvVar`, `minValue`, `maxValue?`): `number`
156
234
 
157
235
  Check the option to see if it exists and is an integer.
158
236
 
159
237
  #### Parameters
160
238
 
161
- **optionName**: `string`
239
+ ##### optionName
240
+
241
+ `string`
162
242
 
163
243
  The name of the option.
164
244
 
165
- **optionValue**: `undefined` \| `string`
245
+ ##### optionValue
166
246
 
167
247
  The option value.
168
248
 
169
- • **allowEnvVar**: `boolean` = `true`
249
+ `undefined` | `string`
250
+
251
+ ##### allowEnvVar
252
+
253
+ `boolean` = `true`
170
254
 
171
255
  Allow the option to be read from an env var.
172
256
 
173
- **minValue**: `number` = `0`
257
+ ##### minValue
258
+
259
+ `number` = `0`
174
260
 
175
261
  The minimum value.
176
262
 
177
- **maxValue?**: `number`
263
+ ##### maxValue?
264
+
265
+ `number`
178
266
 
179
267
  The maximum value.
180
268
 
@@ -192,29 +280,39 @@ An error if the option is invalid.
192
280
 
193
281
  ### bigint()
194
282
 
195
- > `static` **bigint**(`optionName`, `optionValue`, `allowEnvVar`, `minValue`, `maxValue`?): `bigint`
283
+ > `static` **bigint**(`optionName`, `optionValue`, `allowEnvVar`, `minValue`, `maxValue?`): `bigint`
196
284
 
197
285
  Check the option to see if it exists and is a big number.
198
286
 
199
287
  #### Parameters
200
288
 
201
- **optionName**: `string`
289
+ ##### optionName
290
+
291
+ `string`
202
292
 
203
293
  The name of the option.
204
294
 
205
- **optionValue**: `undefined` \| `string`
295
+ ##### optionValue
206
296
 
207
297
  The option value.
208
298
 
209
- • **allowEnvVar**: `boolean` = `true`
299
+ `undefined` | `string`
300
+
301
+ ##### allowEnvVar
302
+
303
+ `boolean` = `true`
210
304
 
211
305
  Allow the option to be read from an env var.
212
306
 
213
- **minValue**: `bigint` = `...`
307
+ ##### minValue
308
+
309
+ `bigint` = `0n`
214
310
 
215
311
  The minimum value.
216
312
 
217
- **maxValue?**: `bigint`
313
+ ##### maxValue?
314
+
315
+ `bigint`
218
316
 
219
317
  The maximum value.
220
318
 
@@ -238,15 +336,21 @@ Check the option to see if it exists and is a boolean.
238
336
 
239
337
  #### Parameters
240
338
 
241
- **optionName**: `string`
339
+ ##### optionName
340
+
341
+ `string`
242
342
 
243
343
  The name of the option.
244
344
 
245
- **optionValue**: `undefined` \| `string`
345
+ ##### optionValue
246
346
 
247
347
  The option value.
248
348
 
249
- • **allowEnvVar**: `boolean` = `true`
349
+ `undefined` | `string`
350
+
351
+ ##### allowEnvVar
352
+
353
+ `boolean` = `true`
250
354
 
251
355
  Allow the option to be read from an env var.
252
356
 
@@ -270,15 +374,21 @@ Check the option to see if it exists and is hex.
270
374
 
271
375
  #### Parameters
272
376
 
273
- **optionName**: `string`
377
+ ##### optionName
378
+
379
+ `string`
274
380
 
275
381
  The name of the option.
276
382
 
277
- **optionValue**: `undefined` \| `string`
383
+ ##### optionValue
278
384
 
279
385
  The option value.
280
386
 
281
- • **allowEnvVar**: `boolean` = `true`
387
+ `undefined` | `string`
388
+
389
+ ##### allowEnvVar
390
+
391
+ `boolean` = `true`
282
392
 
283
393
  Allow the option to be read from an env var.
284
394
 
@@ -302,15 +412,21 @@ Check the option to see if it exists and is base64.
302
412
 
303
413
  #### Parameters
304
414
 
305
- **optionName**: `string`
415
+ ##### optionName
416
+
417
+ `string`
306
418
 
307
419
  The name of the option.
308
420
 
309
- **optionValue**: `undefined` \| `string`
421
+ ##### optionValue
310
422
 
311
423
  The option value.
312
424
 
313
- • **allowEnvVar**: `boolean` = `true`
425
+ `undefined` | `string`
426
+
427
+ ##### allowEnvVar
428
+
429
+ `boolean` = `true`
314
430
 
315
431
  Allow the option to be read from an env var.
316
432
 
@@ -334,15 +450,21 @@ Check the option to see if it exists and is hex or base64.
334
450
 
335
451
  #### Parameters
336
452
 
337
- **optionName**: `string`
453
+ ##### optionName
454
+
455
+ `string`
338
456
 
339
457
  The name of the option.
340
458
 
341
- **optionValue**: `undefined` \| `string`
459
+ ##### optionValue
342
460
 
343
461
  The option value.
344
462
 
345
- • **allowEnvVar**: `boolean` = `true`
463
+ `undefined` | `string`
464
+
465
+ ##### allowEnvVar
466
+
467
+ `boolean` = `true`
346
468
 
347
469
  Allow the option to be read from an env var.
348
470
 
@@ -366,15 +488,21 @@ Check the option to see if it exists and is bech32.
366
488
 
367
489
  #### Parameters
368
490
 
369
- **optionName**: `string`
491
+ ##### optionName
492
+
493
+ `string`
370
494
 
371
495
  The name of the option.
372
496
 
373
- **optionValue**: `undefined` \| `string`
497
+ ##### optionValue
374
498
 
375
499
  The option value.
376
500
 
377
- • **allowEnvVar**: `boolean` = `true`
501
+ `undefined` | `string`
502
+
503
+ ##### allowEnvVar
504
+
505
+ `boolean` = `true`
378
506
 
379
507
  Allow the option to be read from an env var.
380
508