@twin.org/cli-core 0.0.1-next.6 → 0.0.1-next.62

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 @@ 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
 
@@ -82,19 +94,25 @@ An error if the option is invalid.
82
94
 
83
95
  > `static` **url**(`optionName`, `optionValue`, `allowEnvVar`): `string`
84
96
 
85
- Check the option to see if it a url.
97
+ Check the option to see if it is a url.
86
98
 
87
99
  #### Parameters
88
100
 
89
- **optionName**: `string`
101
+ ##### optionName
102
+
103
+ `string`
90
104
 
91
105
  The name of the option.
92
106
 
93
- **optionValue**: `undefined` \| `string`
107
+ ##### optionValue
94
108
 
95
109
  The option value.
96
110
 
97
- • **allowEnvVar**: `boolean` = `true`
111
+ `undefined` | `string`
112
+
113
+ ##### allowEnvVar
114
+
115
+ `boolean` = `true`
98
116
 
99
117
  Allow the option to be read from an env var.
100
118
 
@@ -112,29 +130,39 @@ An error if the option is invalid.
112
130
 
113
131
  ### number()
114
132
 
115
- > `static` **number**(`optionName`, `optionValue`, `allowEnvVar`, `minValue`, `maxValue`?): `number`
133
+ > `static` **number**(`optionName`, `optionValue`, `allowEnvVar`, `minValue`, `maxValue?`): `number`
116
134
 
117
135
  Check the option to see if it exists and is a number.
118
136
 
119
137
  #### Parameters
120
138
 
121
- **optionName**: `string`
139
+ ##### optionName
140
+
141
+ `string`
122
142
 
123
143
  The name of the option.
124
144
 
125
- **optionValue**: `undefined` \| `string`
145
+ ##### optionValue
126
146
 
127
147
  The option value.
128
148
 
129
- • **allowEnvVar**: `boolean` = `true`
149
+ `undefined` | `string`
150
+
151
+ ##### allowEnvVar
152
+
153
+ `boolean` = `true`
130
154
 
131
155
  Allow the option to be read from an env var.
132
156
 
133
- **minValue**: `number` = `0`
157
+ ##### minValue
158
+
159
+ `number` = `0`
134
160
 
135
161
  The minimum value.
136
162
 
137
- **maxValue?**: `number`
163
+ ##### maxValue?
164
+
165
+ `number`
138
166
 
139
167
  The maximum value.
140
168
 
@@ -152,29 +180,39 @@ An error if the option is invalid.
152
180
 
153
181
  ### integer()
154
182
 
155
- > `static` **integer**(`optionName`, `optionValue`, `allowEnvVar`, `minValue`, `maxValue`?): `number`
183
+ > `static` **integer**(`optionName`, `optionValue`, `allowEnvVar`, `minValue`, `maxValue?`): `number`
156
184
 
157
185
  Check the option to see if it exists and is an integer.
158
186
 
159
187
  #### Parameters
160
188
 
161
- **optionName**: `string`
189
+ ##### optionName
190
+
191
+ `string`
162
192
 
163
193
  The name of the option.
164
194
 
165
- **optionValue**: `undefined` \| `string`
195
+ ##### optionValue
166
196
 
167
197
  The option value.
168
198
 
169
- • **allowEnvVar**: `boolean` = `true`
199
+ `undefined` | `string`
200
+
201
+ ##### allowEnvVar
202
+
203
+ `boolean` = `true`
170
204
 
171
205
  Allow the option to be read from an env var.
172
206
 
173
- **minValue**: `number` = `0`
207
+ ##### minValue
208
+
209
+ `number` = `0`
174
210
 
175
211
  The minimum value.
176
212
 
177
- **maxValue?**: `number`
213
+ ##### maxValue?
214
+
215
+ `number`
178
216
 
179
217
  The maximum value.
180
218
 
@@ -192,29 +230,39 @@ An error if the option is invalid.
192
230
 
193
231
  ### bigint()
194
232
 
195
- > `static` **bigint**(`optionName`, `optionValue`, `allowEnvVar`, `minValue`, `maxValue`?): `bigint`
233
+ > `static` **bigint**(`optionName`, `optionValue`, `allowEnvVar`, `minValue`, `maxValue?`): `bigint`
196
234
 
197
235
  Check the option to see if it exists and is a big number.
198
236
 
199
237
  #### Parameters
200
238
 
201
- **optionName**: `string`
239
+ ##### optionName
240
+
241
+ `string`
202
242
 
203
243
  The name of the option.
204
244
 
205
- **optionValue**: `undefined` \| `string`
245
+ ##### optionValue
206
246
 
207
247
  The option value.
208
248
 
209
- • **allowEnvVar**: `boolean` = `true`
249
+ `undefined` | `string`
250
+
251
+ ##### allowEnvVar
252
+
253
+ `boolean` = `true`
210
254
 
211
255
  Allow the option to be read from an env var.
212
256
 
213
- **minValue**: `bigint` = `...`
257
+ ##### minValue
258
+
259
+ `bigint` = `0n`
214
260
 
215
261
  The minimum value.
216
262
 
217
- **maxValue?**: `bigint`
263
+ ##### maxValue?
264
+
265
+ `bigint`
218
266
 
219
267
  The maximum value.
220
268
 
@@ -238,15 +286,21 @@ Check the option to see if it exists and is a boolean.
238
286
 
239
287
  #### Parameters
240
288
 
241
- **optionName**: `string`
289
+ ##### optionName
290
+
291
+ `string`
242
292
 
243
293
  The name of the option.
244
294
 
245
- **optionValue**: `undefined` \| `string`
295
+ ##### optionValue
246
296
 
247
297
  The option value.
248
298
 
249
- • **allowEnvVar**: `boolean` = `true`
299
+ `undefined` | `string`
300
+
301
+ ##### allowEnvVar
302
+
303
+ `boolean` = `true`
250
304
 
251
305
  Allow the option to be read from an env var.
252
306
 
@@ -270,15 +324,21 @@ Check the option to see if it exists and is hex.
270
324
 
271
325
  #### Parameters
272
326
 
273
- **optionName**: `string`
327
+ ##### optionName
328
+
329
+ `string`
274
330
 
275
331
  The name of the option.
276
332
 
277
- **optionValue**: `undefined` \| `string`
333
+ ##### optionValue
278
334
 
279
335
  The option value.
280
336
 
281
- • **allowEnvVar**: `boolean` = `true`
337
+ `undefined` | `string`
338
+
339
+ ##### allowEnvVar
340
+
341
+ `boolean` = `true`
282
342
 
283
343
  Allow the option to be read from an env var.
284
344
 
@@ -302,15 +362,21 @@ Check the option to see if it exists and is base64.
302
362
 
303
363
  #### Parameters
304
364
 
305
- **optionName**: `string`
365
+ ##### optionName
366
+
367
+ `string`
306
368
 
307
369
  The name of the option.
308
370
 
309
- **optionValue**: `undefined` \| `string`
371
+ ##### optionValue
310
372
 
311
373
  The option value.
312
374
 
313
- • **allowEnvVar**: `boolean` = `true`
375
+ `undefined` | `string`
376
+
377
+ ##### allowEnvVar
378
+
379
+ `boolean` = `true`
314
380
 
315
381
  Allow the option to be read from an env var.
316
382
 
@@ -334,15 +400,21 @@ Check the option to see if it exists and is hex or base64.
334
400
 
335
401
  #### Parameters
336
402
 
337
- **optionName**: `string`
403
+ ##### optionName
404
+
405
+ `string`
338
406
 
339
407
  The name of the option.
340
408
 
341
- **optionValue**: `undefined` \| `string`
409
+ ##### optionValue
342
410
 
343
411
  The option value.
344
412
 
345
- • **allowEnvVar**: `boolean` = `true`
413
+ `undefined` | `string`
414
+
415
+ ##### allowEnvVar
416
+
417
+ `boolean` = `true`
346
418
 
347
419
  Allow the option to be read from an env var.
348
420
 
@@ -366,15 +438,21 @@ Check the option to see if it exists and is bech32.
366
438
 
367
439
  #### Parameters
368
440
 
369
- **optionName**: `string`
441
+ ##### optionName
442
+
443
+ `string`
370
444
 
371
445
  The name of the option.
372
446
 
373
- **optionValue**: `undefined` \| `string`
447
+ ##### optionValue
374
448
 
375
449
  The option value.
376
450
 
377
- • **allowEnvVar**: `boolean` = `true`
451
+ `undefined` | `string`
452
+
453
+ ##### allowEnvVar
454
+
455
+ `boolean` = `true`
378
456
 
379
457
  Allow the option to be read from an env var.
380
458
 
@@ -4,13 +4,13 @@ Utilities function for helping in the CLI.
4
4
 
5
5
  ## Constructors
6
6
 
7
- ### new CLIUtils()
7
+ ### Constructor
8
8
 
9
- > **new CLIUtils**(): [`CLIUtils`](CLIUtils.md)
9
+ > **new CLIUtils**(): `CLIUtils`
10
10
 
11
11
  #### Returns
12
12
 
13
- [`CLIUtils`](CLIUtils.md)
13
+ `CLIUtils`
14
14
 
15
15
  ## Methods
16
16
 
@@ -22,7 +22,9 @@ Does the specified file exist.
22
22
 
23
23
  #### Parameters
24
24
 
25
- **filename**: `string`
25
+ ##### filename
26
+
27
+ `string`
26
28
 
27
29
  The filename to check for existence.
28
30
 
@@ -42,7 +44,9 @@ Does the specified file exist, synchronously.
42
44
 
43
45
  #### Parameters
44
46
 
45
- **filename**: `string`
47
+ ##### filename
48
+
49
+ `string`
46
50
 
47
51
  The filename to check for existence.
48
52
 
@@ -62,7 +66,9 @@ Check if the dir exists.
62
66
 
63
67
  #### Parameters
64
68
 
65
- **dir**: `string`
69
+ ##### dir
70
+
71
+ `string`
66
72
 
67
73
  The directory to check.
68
74
 
@@ -82,7 +88,9 @@ Check if the dir exists, synchronously.
82
88
 
83
89
  #### Parameters
84
90
 
85
- **dir**: `string`
91
+ ##### dir
92
+
93
+ `string`
86
94
 
87
95
  The directory to check.
88
96
 
@@ -102,11 +110,15 @@ Read a JSON file and parse it.
102
110
 
103
111
  #### Type Parameters
104
112
 
105
- **T** = `unknown`
113
+ ##### T
114
+
115
+ `T` = `unknown`
106
116
 
107
117
  #### Parameters
108
118
 
109
- **filename**: `string`
119
+ ##### filename
120
+
121
+ `string`
110
122
 
111
123
  The filename to read.
112
124
 
@@ -126,11 +138,15 @@ Read a JSON file and parse it, synchronously.
126
138
 
127
139
  #### Type Parameters
128
140
 
129
- **T** = `unknown`
141
+ ##### T
142
+
143
+ `T` = `unknown`
130
144
 
131
145
  #### Parameters
132
146
 
133
- **filename**: `string`
147
+ ##### filename
148
+
149
+ `string`
134
150
 
135
151
  The filename to read.
136
152
 
@@ -150,7 +166,9 @@ Read a file as lines.
150
166
 
151
167
  #### Parameters
152
168
 
153
- **filename**: `string`
169
+ ##### filename
170
+
171
+ `string`
154
172
 
155
173
  The filename to read.
156
174
 
@@ -170,7 +188,9 @@ Read a file as lines, synchronously.
170
188
 
171
189
  #### Parameters
172
190
 
173
- **filename**: `string`
191
+ ##### filename
192
+
193
+ `string`
174
194
 
175
195
  The filename to read.
176
196
 
@@ -190,7 +210,9 @@ Find the NPM root based on a package.json path.
190
210
 
191
211
  #### Parameters
192
212
 
193
- **rootFolder**: `string`
213
+ ##### rootFolder
214
+
215
+ `string`
194
216
 
195
217
  The path to the package.json.
196
218
 
@@ -204,21 +226,61 @@ The root path.
204
226
 
205
227
  ### runShellCmd()
206
228
 
207
- > `static` **runShellCmd**(`app`, `args`, `cwd`): `Promise`\<`void`\>
229
+ > `static` **runShellCmd**(`command`, `args`, `cwd`): `Promise`\<`void`\>
230
+
231
+ Run a shell command.
232
+
233
+ #### Parameters
234
+
235
+ ##### command
236
+
237
+ `string`
238
+
239
+ The app to run in the shell.
240
+
241
+ ##### args
242
+
243
+ `string`[]
244
+
245
+ The args for the app.
246
+
247
+ ##### cwd
248
+
249
+ `string`
250
+
251
+ The working directory to execute the command in.
252
+
253
+ #### Returns
254
+
255
+ `Promise`\<`void`\>
256
+
257
+ Promise to wait for command execution to complete.
258
+
259
+ ***
260
+
261
+ ### runShellApp()
262
+
263
+ > `static` **runShellApp**(`app`, `args`, `cwd`): `Promise`\<`void`\>
208
264
 
209
265
  Run a shell app.
210
266
 
211
267
  #### Parameters
212
268
 
213
- **app**: `string`
269
+ ##### app
270
+
271
+ `string`
214
272
 
215
273
  The app to run in the shell.
216
274
 
217
- **args**: `string`[]
275
+ ##### args
276
+
277
+ `string`[]
218
278
 
219
279
  The args for the app.
220
280
 
221
- **cwd**: `string`
281
+ ##### cwd
282
+
283
+ `string`
222
284
 
223
285
  The working directory to execute the command in.
224
286
 
@@ -238,19 +300,27 @@ Write a JSON file.
238
300
 
239
301
  #### Type Parameters
240
302
 
241
- **T** = `unknown`
303
+ ##### T
304
+
305
+ `T` = `unknown`
242
306
 
243
307
  #### Parameters
244
308
 
245
- **jsonFilename**: `undefined` \| `string`
309
+ ##### jsonFilename
246
310
 
247
311
  The filename to write.
248
312
 
249
- **data**: `T`
313
+ `undefined` | `string`
314
+
315
+ ##### data
316
+
317
+ `T`
250
318
 
251
319
  The data to write.
252
320
 
253
- **append**: `boolean`
321
+ ##### append
322
+
323
+ `boolean`
254
324
 
255
325
  Append to the file.
256
326
 
@@ -268,15 +338,21 @@ Write an env file.
268
338
 
269
339
  #### Parameters
270
340
 
271
- **envFilename**: `undefined` \| `string`
341
+ ##### envFilename
272
342
 
273
343
  The filename to write.
274
344
 
275
- **data**: `string`[]
345
+ `undefined` | `string`
346
+
347
+ ##### data
348
+
349
+ `string`[]
276
350
 
277
351
  The data to write.
278
352
 
279
- **append**: `boolean`
353
+ ##### append
354
+
355
+ `boolean`
280
356
 
281
357
  Append to the file.
282
358
 
@@ -6,15 +6,21 @@ Add the global options.
6
6
 
7
7
  ## Parameters
8
8
 
9
- **program**: `Command`
9
+ ### program
10
+
11
+ `Command`
10
12
 
11
13
  The program to add the options to.
12
14
 
13
- **supportsLang**: `boolean`
15
+ ### supportsLang
16
+
17
+ `boolean`
14
18
 
15
19
  Whether the CLI supports different languages.
16
20
 
17
- **supportsEnvFiles**: `boolean`
21
+ ### supportsEnvFiles
22
+
23
+ `boolean`
18
24
 
19
25
  Whether the CLI supports loading env files
20
26
 
@@ -6,7 +6,9 @@ Initialize the global options.
6
6
 
7
7
  ## Parameters
8
8
 
9
- **localesDirectory**: `string`
9
+ ### localesDirectory
10
+
11
+ `string`
10
12
 
11
13
  The path to load the locales from.
12
14