@twin.org/cli-core 0.0.1-next.9 → 0.0.2-next.3
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/dist/cjs/index.cjs +18 -8
- package/dist/esm/index.mjs +18 -8
- package/dist/types/cliParam.d.ts +2 -2
- package/dist/types/cliUtils.d.ts +9 -1
- package/docs/changelog.md +455 -1
- package/docs/reference/classes/CLIBase.md +18 -8
- package/docs/reference/classes/CLIDisplay.md +55 -21
- package/docs/reference/classes/CLIOptions.md +22 -10
- package/docs/reference/classes/CLIParam.md +125 -47
- package/docs/reference/classes/CLIUtils.md +101 -25
- package/docs/reference/functions/addGlobalOptions.md +9 -3
- package/docs/reference/functions/initGlobalOptions.md +3 -1
- package/docs/reference/type-aliases/CliOutputOptions.md +1 -1
- package/package.json +9 -9
|
@@ -4,13 +4,13 @@ Utilities function for helping in the CLI.
|
|
|
4
4
|
|
|
5
5
|
## Constructors
|
|
6
6
|
|
|
7
|
-
###
|
|
7
|
+
### Constructor
|
|
8
8
|
|
|
9
|
-
> **new CLIUtils**():
|
|
9
|
+
> **new CLIUtils**(): `CLIUtils`
|
|
10
10
|
|
|
11
11
|
#### Returns
|
|
12
12
|
|
|
13
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
113
|
+
##### T
|
|
114
|
+
|
|
115
|
+
`T` = `unknown`
|
|
106
116
|
|
|
107
117
|
#### Parameters
|
|
108
118
|
|
|
109
|
-
|
|
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
|
-
|
|
141
|
+
##### T
|
|
142
|
+
|
|
143
|
+
`T` = `unknown`
|
|
130
144
|
|
|
131
145
|
#### Parameters
|
|
132
146
|
|
|
133
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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**(`
|
|
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
|
-
|
|
269
|
+
##### app
|
|
270
|
+
|
|
271
|
+
`string`
|
|
214
272
|
|
|
215
273
|
The app to run in the shell.
|
|
216
274
|
|
|
217
|
-
|
|
275
|
+
##### args
|
|
276
|
+
|
|
277
|
+
`string`[]
|
|
218
278
|
|
|
219
279
|
The args for the app.
|
|
220
280
|
|
|
221
|
-
|
|
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
|
-
|
|
303
|
+
##### T
|
|
304
|
+
|
|
305
|
+
`T` = `unknown`
|
|
242
306
|
|
|
243
307
|
#### Parameters
|
|
244
308
|
|
|
245
|
-
|
|
309
|
+
##### jsonFilename
|
|
246
310
|
|
|
247
311
|
The filename to write.
|
|
248
312
|
|
|
249
|
-
|
|
313
|
+
`undefined` | `string`
|
|
314
|
+
|
|
315
|
+
##### data
|
|
316
|
+
|
|
317
|
+
`T`
|
|
250
318
|
|
|
251
319
|
The data to write.
|
|
252
320
|
|
|
253
|
-
|
|
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
|
-
|
|
341
|
+
##### envFilename
|
|
272
342
|
|
|
273
343
|
The filename to write.
|
|
274
344
|
|
|
275
|
-
|
|
345
|
+
`undefined` | `string`
|
|
346
|
+
|
|
347
|
+
##### data
|
|
348
|
+
|
|
349
|
+
`string`[]
|
|
276
350
|
|
|
277
351
|
The data to write.
|
|
278
352
|
|
|
279
|
-
|
|
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
|
-
|
|
9
|
+
### program
|
|
10
|
+
|
|
11
|
+
`Command`
|
|
10
12
|
|
|
11
13
|
The program to add the options to.
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
### supportsLang
|
|
16
|
+
|
|
17
|
+
`boolean`
|
|
14
18
|
|
|
15
19
|
Whether the CLI supports different languages.
|
|
16
20
|
|
|
17
|
-
|
|
21
|
+
### supportsEnvFiles
|
|
22
|
+
|
|
23
|
+
`boolean`
|
|
18
24
|
|
|
19
25
|
Whether the CLI supports loading env files
|
|
20
26
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# Type Alias: CliOutputOptions
|
|
2
2
|
|
|
3
|
-
> **CliOutputOptions
|
|
3
|
+
> **CliOutputOptions** = [`ICliOutputOptionsConsole`](../interfaces/ICliOutputOptionsConsole.md) & [`ICliOutputOptionsEnv`](../interfaces/ICliOutputOptionsEnv.md) & [`ICliOutputOptionsJson`](../interfaces/ICliOutputOptionsJson.md)
|
|
4
4
|
|
|
5
5
|
Options for the CLI Output.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/cli-core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2-next.3",
|
|
4
4
|
"description": "Core classes for building a CLI",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,21 +14,21 @@
|
|
|
14
14
|
"node": ">=20.0.0"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@twin.org/core": "0.0.
|
|
18
|
-
"@twin.org/crypto": "0.0.
|
|
19
|
-
"@twin.org/nameof": "next",
|
|
20
|
-
"chalk": "5.
|
|
21
|
-
"commander": "
|
|
22
|
-
"dotenv": "
|
|
17
|
+
"@twin.org/core": "0.0.2-next.3",
|
|
18
|
+
"@twin.org/crypto": "0.0.2-next.3",
|
|
19
|
+
"@twin.org/nameof": "0.0.2-next.3",
|
|
20
|
+
"chalk": "5.4.1",
|
|
21
|
+
"commander": "14.0.0",
|
|
22
|
+
"dotenv": "17.2.0"
|
|
23
23
|
},
|
|
24
24
|
"main": "./dist/cjs/index.cjs",
|
|
25
25
|
"module": "./dist/esm/index.mjs",
|
|
26
26
|
"types": "./dist/types/index.d.ts",
|
|
27
27
|
"exports": {
|
|
28
28
|
".": {
|
|
29
|
+
"types": "./dist/types/index.d.ts",
|
|
29
30
|
"require": "./dist/cjs/index.cjs",
|
|
30
|
-
"import": "./dist/esm/index.mjs"
|
|
31
|
-
"types": "./dist/types/index.d.ts"
|
|
31
|
+
"import": "./dist/esm/index.mjs"
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
34
|
"files": [
|