@twin.org/cli-core 0.0.3-next.21 → 0.0.3-next.23
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/README.md +2 -2
- package/docs/changelog.md +37 -1
- package/docs/examples.md +82 -1
- package/docs/reference/classes/CLIBase.md +3 -3
- package/docs/reference/classes/CLIDisplay.md +23 -23
- package/docs/reference/classes/CLIOptions.md +1 -1
- package/docs/reference/classes/CLIParam.md +34 -34
- package/docs/reference/classes/CLIUtils.md +13 -13
- package/docs/reference/interfaces/ICliOptions.md +8 -8
- package/docs/reference/interfaces/ICliOutputOptionsConsole.md +1 -1
- package/docs/reference/interfaces/ICliOutputOptionsEnv.md +2 -2
- package/docs/reference/interfaces/ICliOutputOptionsJson.md +2 -2
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# TWIN CLI Core
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This package is part of the framework workspace and provides core classes for building a CLI to support consistent development workflows across the ecosystem.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -10,7 +10,7 @@ npm install @twin.org/cli-core
|
|
|
10
10
|
|
|
11
11
|
## Examples
|
|
12
12
|
|
|
13
|
-
Usage of the
|
|
13
|
+
Usage of the APIs is shown in the examples [docs/examples.md](docs/examples.md)
|
|
14
14
|
|
|
15
15
|
## Reference
|
|
16
16
|
|
package/docs/changelog.md
CHANGED
|
@@ -1,4 +1,40 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.0.3-next.23](https://github.com/twinfoundation/framework/compare/cli-core-v0.0.3-next.22...cli-core-v0.0.3-next.23) (2026-03-17)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Miscellaneous Chores
|
|
7
|
+
|
|
8
|
+
* **cli-core:** Synchronize repo versions
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* The following workspace dependencies were updated
|
|
14
|
+
* dependencies
|
|
15
|
+
* @twin.org/core bumped from 0.0.3-next.22 to 0.0.3-next.23
|
|
16
|
+
* @twin.org/nameof bumped from 0.0.3-next.22 to 0.0.3-next.23
|
|
17
|
+
* devDependencies
|
|
18
|
+
* @twin.org/nameof-transformer bumped from 0.0.3-next.22 to 0.0.3-next.23
|
|
19
|
+
* @twin.org/nameof-vitest-plugin bumped from 0.0.3-next.22 to 0.0.3-next.23
|
|
20
|
+
|
|
21
|
+
## [0.0.3-next.22](https://github.com/twinfoundation/framework/compare/cli-core-v0.0.3-next.21...cli-core-v0.0.3-next.22) (2026-02-26)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Miscellaneous Chores
|
|
25
|
+
|
|
26
|
+
* **cli-core:** Synchronize repo versions
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### Dependencies
|
|
30
|
+
|
|
31
|
+
* The following workspace dependencies were updated
|
|
32
|
+
* dependencies
|
|
33
|
+
* @twin.org/core bumped from 0.0.3-next.21 to 0.0.3-next.22
|
|
34
|
+
* @twin.org/nameof bumped from 0.0.3-next.21 to 0.0.3-next.22
|
|
35
|
+
* devDependencies
|
|
36
|
+
* @twin.org/nameof-transformer bumped from 0.0.3-next.21 to 0.0.3-next.22
|
|
37
|
+
* @twin.org/nameof-vitest-plugin bumped from 0.0.3-next.21 to 0.0.3-next.22
|
|
2
38
|
|
|
3
39
|
## [0.0.3-next.21](https://github.com/twinfoundation/framework/compare/cli-core-v0.0.3-next.20...cli-core-v0.0.3-next.21) (2026-02-26)
|
|
4
40
|
|
package/docs/examples.md
CHANGED
|
@@ -1 +1,82 @@
|
|
|
1
|
-
#
|
|
1
|
+
# CLI Core Examples
|
|
2
|
+
|
|
3
|
+
Use these snippets to compose clear command line workflows with consistent output, argument parsing and file handling.
|
|
4
|
+
|
|
5
|
+
## CLIDisplay
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { CLIDisplay } from '@twin.org/cli-core';
|
|
9
|
+
|
|
10
|
+
CLIDisplay.header('Data Import', '1.2.0');
|
|
11
|
+
CLIDisplay.section('Validation');
|
|
12
|
+
CLIDisplay.value('Records', 128);
|
|
13
|
+
CLIDisplay.warning('2 rows have missing optional fields');
|
|
14
|
+
CLIDisplay.done();
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## CLIParam
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
import { CLIParam } from '@twin.org/cli-core';
|
|
21
|
+
|
|
22
|
+
const parsedCount = CLIParam.integer('count', '25');
|
|
23
|
+
const parsedDebug = CLIParam.boolean('debug', 'true');
|
|
24
|
+
const parsedUrl = CLIParam.url('endpoint', 'https://api.example.org');
|
|
25
|
+
|
|
26
|
+
console.log(parsedCount + 1); // 26
|
|
27
|
+
console.log(parsedDebug); // true
|
|
28
|
+
console.log(parsedUrl.host); // api.example.org
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## CLIBase
|
|
32
|
+
|
|
33
|
+
```typescript
|
|
34
|
+
import { CLIBase } from '@twin.org/cli-core';
|
|
35
|
+
import type { Command } from 'commander';
|
|
36
|
+
|
|
37
|
+
class ToolCli extends CLIBase {
|
|
38
|
+
protected getCommands(program: Command): Command[] {
|
|
39
|
+
return [program.command('status').action(() => {})];
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const cli = new ToolCli();
|
|
44
|
+
const exitCode = await cli.execute(
|
|
45
|
+
{
|
|
46
|
+
appName: 'tool-cli',
|
|
47
|
+
title: 'Tool CLI',
|
|
48
|
+
version: '1.0.0'
|
|
49
|
+
},
|
|
50
|
+
'./locales',
|
|
51
|
+
['node', 'tool-cli', 'status']
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
console.log(exitCode); // 0
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## CLIUtils
|
|
58
|
+
|
|
59
|
+
```typescript
|
|
60
|
+
import { CLIUtils } from '@twin.org/cli-core';
|
|
61
|
+
|
|
62
|
+
console.log(await CLIUtils.fileExists('./config/import.json')); // true
|
|
63
|
+
const config = await CLIUtils.readJsonFile<{ source: string }>('./config/import.json');
|
|
64
|
+
await CLIUtils.writeEnvFile('./dist/import.env', {
|
|
65
|
+
SOURCE: config.source
|
|
66
|
+
});
|
|
67
|
+
console.log(config.source); // ./data/source.json
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## CLIOptions
|
|
71
|
+
|
|
72
|
+
```typescript
|
|
73
|
+
import { CLIOptions } from '@twin.org/cli-core';
|
|
74
|
+
|
|
75
|
+
const options = new CLIOptions();
|
|
76
|
+
|
|
77
|
+
options.output({
|
|
78
|
+
json: './dist/output.json'
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
console.log(options.toObject().json); // ./dist/output.json
|
|
82
|
+
```
|
|
@@ -14,7 +14,7 @@ The main entry point for the CLI.
|
|
|
14
14
|
|
|
15
15
|
## Methods
|
|
16
16
|
|
|
17
|
-
### execute()
|
|
17
|
+
### execute() {#execute}
|
|
18
18
|
|
|
19
19
|
> **execute**(`options`, `localesDirectory`, `argv`): `Promise`\<`number`\>
|
|
20
20
|
|
|
@@ -48,7 +48,7 @@ The exit code.
|
|
|
48
48
|
|
|
49
49
|
***
|
|
50
50
|
|
|
51
|
-
### configureRoot()
|
|
51
|
+
### configureRoot() {#configureroot}
|
|
52
52
|
|
|
53
53
|
> `protected` **configureRoot**(`program`): `void`
|
|
54
54
|
|
|
@@ -68,7 +68,7 @@ The root program command.
|
|
|
68
68
|
|
|
69
69
|
***
|
|
70
70
|
|
|
71
|
-
### getCommands()
|
|
71
|
+
### getCommands() {#getcommands}
|
|
72
72
|
|
|
73
73
|
> `protected` **getCommands**(`program`): `Command`[]
|
|
74
74
|
|
|
@@ -14,7 +14,7 @@ Display utilities for the CLI.
|
|
|
14
14
|
|
|
15
15
|
## Properties
|
|
16
16
|
|
|
17
|
-
### write()
|
|
17
|
+
### write() {#write}
|
|
18
18
|
|
|
19
19
|
> `static` **write**: (`buffer`) => `void`
|
|
20
20
|
|
|
@@ -34,7 +34,7 @@ The message to output.
|
|
|
34
34
|
|
|
35
35
|
***
|
|
36
36
|
|
|
37
|
-
### writeError()
|
|
37
|
+
### writeError() {#writeerror}
|
|
38
38
|
|
|
39
39
|
> `static` **writeError**: (`buffer`) => `void`
|
|
40
40
|
|
|
@@ -54,7 +54,7 @@ The message to output.
|
|
|
54
54
|
|
|
55
55
|
***
|
|
56
56
|
|
|
57
|
-
### clearLine()
|
|
57
|
+
### clearLine() {#clearline}
|
|
58
58
|
|
|
59
59
|
> `static` **clearLine**: () => `void`
|
|
60
60
|
|
|
@@ -66,7 +66,7 @@ The default output method for clearing the current line.
|
|
|
66
66
|
|
|
67
67
|
## Methods
|
|
68
68
|
|
|
69
|
-
### header()
|
|
69
|
+
### header() {#header}
|
|
70
70
|
|
|
71
71
|
> `static` **header**(`title`, `version`, `icon`): `void`
|
|
72
72
|
|
|
@@ -98,9 +98,9 @@ The icon for the CLI.
|
|
|
98
98
|
|
|
99
99
|
***
|
|
100
100
|
|
|
101
|
-
### error()
|
|
101
|
+
### error() {#error}
|
|
102
102
|
|
|
103
|
-
> `static` **error**(`error`, `lineBreaks
|
|
103
|
+
> `static` **error**(`error`, `lineBreaks?`): `void`
|
|
104
104
|
|
|
105
105
|
Display an error message.
|
|
106
106
|
|
|
@@ -112,7 +112,7 @@ Display an error message.
|
|
|
112
112
|
|
|
113
113
|
The error to display.
|
|
114
114
|
|
|
115
|
-
##### lineBreaks
|
|
115
|
+
##### lineBreaks?
|
|
116
116
|
|
|
117
117
|
`boolean` = `true`
|
|
118
118
|
|
|
@@ -124,7 +124,7 @@ Whether to add a line break after the error.
|
|
|
124
124
|
|
|
125
125
|
***
|
|
126
126
|
|
|
127
|
-
### errorMessage()
|
|
127
|
+
### errorMessage() {#errormessage}
|
|
128
128
|
|
|
129
129
|
> `static` **errorMessage**(`error`): `void`
|
|
130
130
|
|
|
@@ -144,7 +144,7 @@ The error to display.
|
|
|
144
144
|
|
|
145
145
|
***
|
|
146
146
|
|
|
147
|
-
### section()
|
|
147
|
+
### section() {#section}
|
|
148
148
|
|
|
149
149
|
> `static` **section**(`label`): `void`
|
|
150
150
|
|
|
@@ -164,9 +164,9 @@ The label for the section.
|
|
|
164
164
|
|
|
165
165
|
***
|
|
166
166
|
|
|
167
|
-
### value()
|
|
167
|
+
### value() {#value}
|
|
168
168
|
|
|
169
|
-
> `static` **value**(`label`, `value`, `indentLevel
|
|
169
|
+
> `static` **value**(`label`, `value`, `indentLevel?`): `void`
|
|
170
170
|
|
|
171
171
|
Display a value with a label.
|
|
172
172
|
|
|
@@ -184,7 +184,7 @@ The label for the value.
|
|
|
184
184
|
|
|
185
185
|
The value to display.
|
|
186
186
|
|
|
187
|
-
##### indentLevel
|
|
187
|
+
##### indentLevel?
|
|
188
188
|
|
|
189
189
|
`number` = `0`
|
|
190
190
|
|
|
@@ -196,7 +196,7 @@ The level of indentation.
|
|
|
196
196
|
|
|
197
197
|
***
|
|
198
198
|
|
|
199
|
-
### task()
|
|
199
|
+
### task() {#task}
|
|
200
200
|
|
|
201
201
|
> `static` **task**(`label`, `task?`): `void`
|
|
202
202
|
|
|
@@ -222,7 +222,7 @@ The task to display.
|
|
|
222
222
|
|
|
223
223
|
***
|
|
224
224
|
|
|
225
|
-
### break()
|
|
225
|
+
### break() {#break}
|
|
226
226
|
|
|
227
227
|
> `static` **break**(): `void`
|
|
228
228
|
|
|
@@ -234,7 +234,7 @@ Display a break.
|
|
|
234
234
|
|
|
235
235
|
***
|
|
236
236
|
|
|
237
|
-
### json()
|
|
237
|
+
### json() {#json}
|
|
238
238
|
|
|
239
239
|
> `static` **json**(`obj`): `void`
|
|
240
240
|
|
|
@@ -254,7 +254,7 @@ The object to display.
|
|
|
254
254
|
|
|
255
255
|
***
|
|
256
256
|
|
|
257
|
-
### warning()
|
|
257
|
+
### warning() {#warning}
|
|
258
258
|
|
|
259
259
|
> `static` **warning**(`label`): `void`
|
|
260
260
|
|
|
@@ -274,7 +274,7 @@ The label for the warning.
|
|
|
274
274
|
|
|
275
275
|
***
|
|
276
276
|
|
|
277
|
-
### done()
|
|
277
|
+
### done() {#done}
|
|
278
278
|
|
|
279
279
|
> `static` **done**(): `void`
|
|
280
280
|
|
|
@@ -286,27 +286,27 @@ Display the processing is done.
|
|
|
286
286
|
|
|
287
287
|
***
|
|
288
288
|
|
|
289
|
-
### spinnerStart()
|
|
289
|
+
### spinnerStart() {#spinnerstart}
|
|
290
290
|
|
|
291
|
-
> `static` **spinnerStart**(`i18nMessage
|
|
291
|
+
> `static` **spinnerStart**(`i18nMessage?`, `spinnerCharacters?`, `interval?`): `void`
|
|
292
292
|
|
|
293
293
|
Start the spinner.
|
|
294
294
|
|
|
295
295
|
#### Parameters
|
|
296
296
|
|
|
297
|
-
##### i18nMessage
|
|
297
|
+
##### i18nMessage?
|
|
298
298
|
|
|
299
299
|
`string` = `"cli.progress.pleaseWait"`
|
|
300
300
|
|
|
301
301
|
The message to display with the spinner.
|
|
302
302
|
|
|
303
|
-
##### spinnerCharacters
|
|
303
|
+
##### spinnerCharacters?
|
|
304
304
|
|
|
305
305
|
`string`[] = `...`
|
|
306
306
|
|
|
307
307
|
The characters to use in the spinner.
|
|
308
308
|
|
|
309
|
-
##### interval
|
|
309
|
+
##### interval?
|
|
310
310
|
|
|
311
311
|
`number` = `100`
|
|
312
312
|
|
|
@@ -318,7 +318,7 @@ The interval for the spinner.
|
|
|
318
318
|
|
|
319
319
|
***
|
|
320
320
|
|
|
321
|
-
### spinnerStop()
|
|
321
|
+
### spinnerStop() {#spinnerstop}
|
|
322
322
|
|
|
323
323
|
> `static` **spinnerStop**(): `void`
|
|
324
324
|
|
|
@@ -14,7 +14,7 @@ Parameter utilities for the CLI.
|
|
|
14
14
|
|
|
15
15
|
## Methods
|
|
16
16
|
|
|
17
|
-
### env()
|
|
17
|
+
### env() {#env}
|
|
18
18
|
|
|
19
19
|
> `static` **env**(`optionName`, `optionValue`, `allowEnvVar`): `string` \| `undefined`
|
|
20
20
|
|
|
@@ -52,9 +52,9 @@ An error if the option is invalid.
|
|
|
52
52
|
|
|
53
53
|
***
|
|
54
54
|
|
|
55
|
-
### stringValue()
|
|
55
|
+
### stringValue() {#stringvalue}
|
|
56
56
|
|
|
57
|
-
> `static` **stringValue**(`optionName`, `optionValue`, `allowEnvVar
|
|
57
|
+
> `static` **stringValue**(`optionName`, `optionValue`, `allowEnvVar?`): `string`
|
|
58
58
|
|
|
59
59
|
Check the option to see if the String exists.
|
|
60
60
|
|
|
@@ -72,7 +72,7 @@ The option value.
|
|
|
72
72
|
|
|
73
73
|
`string` | `undefined`
|
|
74
74
|
|
|
75
|
-
##### allowEnvVar
|
|
75
|
+
##### allowEnvVar?
|
|
76
76
|
|
|
77
77
|
`boolean` = `true`
|
|
78
78
|
|
|
@@ -90,9 +90,9 @@ An error if the option is invalid.
|
|
|
90
90
|
|
|
91
91
|
***
|
|
92
92
|
|
|
93
|
-
### arrayOneOf()
|
|
93
|
+
### arrayOneOf() {#arrayoneof}
|
|
94
94
|
|
|
95
|
-
> `static` **arrayOneOf**\<`T`\>(`optionName`, `optionValue`, `validValues`, `allowEnvVar
|
|
95
|
+
> `static` **arrayOneOf**\<`T`\>(`optionName`, `optionValue`, `validValues`, `allowEnvVar?`): `T`
|
|
96
96
|
|
|
97
97
|
Check the option to see if the value exists in the specific array.
|
|
98
98
|
|
|
@@ -122,7 +122,7 @@ The option value.
|
|
|
122
122
|
|
|
123
123
|
The valid values.
|
|
124
124
|
|
|
125
|
-
##### allowEnvVar
|
|
125
|
+
##### allowEnvVar?
|
|
126
126
|
|
|
127
127
|
`boolean` = `true`
|
|
128
128
|
|
|
@@ -140,9 +140,9 @@ An error if the option is invalid.
|
|
|
140
140
|
|
|
141
141
|
***
|
|
142
142
|
|
|
143
|
-
### url()
|
|
143
|
+
### url() {#url}
|
|
144
144
|
|
|
145
|
-
> `static` **url**(`optionName`, `optionValue`, `allowEnvVar
|
|
145
|
+
> `static` **url**(`optionName`, `optionValue`, `allowEnvVar?`): `string`
|
|
146
146
|
|
|
147
147
|
Check the option to see if it is a url.
|
|
148
148
|
|
|
@@ -160,7 +160,7 @@ The option value.
|
|
|
160
160
|
|
|
161
161
|
`string` | `undefined`
|
|
162
162
|
|
|
163
|
-
##### allowEnvVar
|
|
163
|
+
##### allowEnvVar?
|
|
164
164
|
|
|
165
165
|
`boolean` = `true`
|
|
166
166
|
|
|
@@ -178,9 +178,9 @@ An error if the option is invalid.
|
|
|
178
178
|
|
|
179
179
|
***
|
|
180
180
|
|
|
181
|
-
### number()
|
|
181
|
+
### number() {#number}
|
|
182
182
|
|
|
183
|
-
> `static` **number**(`optionName`, `optionValue`, `allowEnvVar
|
|
183
|
+
> `static` **number**(`optionName`, `optionValue`, `allowEnvVar?`, `minValue?`, `maxValue?`): `number`
|
|
184
184
|
|
|
185
185
|
Check the option to see if it exists and is a number.
|
|
186
186
|
|
|
@@ -198,13 +198,13 @@ The option value.
|
|
|
198
198
|
|
|
199
199
|
`string` | `undefined`
|
|
200
200
|
|
|
201
|
-
##### allowEnvVar
|
|
201
|
+
##### allowEnvVar?
|
|
202
202
|
|
|
203
203
|
`boolean` = `true`
|
|
204
204
|
|
|
205
205
|
Allow the option to be read from an env var.
|
|
206
206
|
|
|
207
|
-
##### minValue
|
|
207
|
+
##### minValue?
|
|
208
208
|
|
|
209
209
|
`number` = `0`
|
|
210
210
|
|
|
@@ -228,9 +228,9 @@ An error if the option is invalid.
|
|
|
228
228
|
|
|
229
229
|
***
|
|
230
230
|
|
|
231
|
-
### integer()
|
|
231
|
+
### integer() {#integer}
|
|
232
232
|
|
|
233
|
-
> `static` **integer**(`optionName`, `optionValue`, `allowEnvVar
|
|
233
|
+
> `static` **integer**(`optionName`, `optionValue`, `allowEnvVar?`, `minValue?`, `maxValue?`): `number`
|
|
234
234
|
|
|
235
235
|
Check the option to see if it exists and is an integer.
|
|
236
236
|
|
|
@@ -248,13 +248,13 @@ The option value.
|
|
|
248
248
|
|
|
249
249
|
`string` | `undefined`
|
|
250
250
|
|
|
251
|
-
##### allowEnvVar
|
|
251
|
+
##### allowEnvVar?
|
|
252
252
|
|
|
253
253
|
`boolean` = `true`
|
|
254
254
|
|
|
255
255
|
Allow the option to be read from an env var.
|
|
256
256
|
|
|
257
|
-
##### minValue
|
|
257
|
+
##### minValue?
|
|
258
258
|
|
|
259
259
|
`number` = `0`
|
|
260
260
|
|
|
@@ -278,9 +278,9 @@ An error if the option is invalid.
|
|
|
278
278
|
|
|
279
279
|
***
|
|
280
280
|
|
|
281
|
-
### bigint()
|
|
281
|
+
### bigint() {#bigint}
|
|
282
282
|
|
|
283
|
-
> `static` **bigint**(`optionName`, `optionValue`, `allowEnvVar
|
|
283
|
+
> `static` **bigint**(`optionName`, `optionValue`, `allowEnvVar?`, `minValue?`, `maxValue?`): `bigint`
|
|
284
284
|
|
|
285
285
|
Check the option to see if it exists and is a big number.
|
|
286
286
|
|
|
@@ -298,13 +298,13 @@ The option value.
|
|
|
298
298
|
|
|
299
299
|
`string` | `undefined`
|
|
300
300
|
|
|
301
|
-
##### allowEnvVar
|
|
301
|
+
##### allowEnvVar?
|
|
302
302
|
|
|
303
303
|
`boolean` = `true`
|
|
304
304
|
|
|
305
305
|
Allow the option to be read from an env var.
|
|
306
306
|
|
|
307
|
-
##### minValue
|
|
307
|
+
##### minValue?
|
|
308
308
|
|
|
309
309
|
`bigint` = `0n`
|
|
310
310
|
|
|
@@ -328,9 +328,9 @@ An error if the option is invalid.
|
|
|
328
328
|
|
|
329
329
|
***
|
|
330
330
|
|
|
331
|
-
### boolean()
|
|
331
|
+
### boolean() {#boolean}
|
|
332
332
|
|
|
333
|
-
> `static` **boolean**(`optionName`, `optionValue`, `allowEnvVar
|
|
333
|
+
> `static` **boolean**(`optionName`, `optionValue`, `allowEnvVar?`): `boolean`
|
|
334
334
|
|
|
335
335
|
Check the option to see if it exists and is a boolean.
|
|
336
336
|
|
|
@@ -348,7 +348,7 @@ The option value.
|
|
|
348
348
|
|
|
349
349
|
`string` | `undefined`
|
|
350
350
|
|
|
351
|
-
##### allowEnvVar
|
|
351
|
+
##### allowEnvVar?
|
|
352
352
|
|
|
353
353
|
`boolean` = `true`
|
|
354
354
|
|
|
@@ -366,9 +366,9 @@ An error if the option is invalid.
|
|
|
366
366
|
|
|
367
367
|
***
|
|
368
368
|
|
|
369
|
-
### hex()
|
|
369
|
+
### hex() {#hex}
|
|
370
370
|
|
|
371
|
-
> `static` **hex**(`optionName`, `optionValue`, `allowEnvVar
|
|
371
|
+
> `static` **hex**(`optionName`, `optionValue`, `allowEnvVar?`): `Uint8Array`
|
|
372
372
|
|
|
373
373
|
Check the option to see if it exists and is hex.
|
|
374
374
|
|
|
@@ -386,7 +386,7 @@ The option value.
|
|
|
386
386
|
|
|
387
387
|
`string` | `undefined`
|
|
388
388
|
|
|
389
|
-
##### allowEnvVar
|
|
389
|
+
##### allowEnvVar?
|
|
390
390
|
|
|
391
391
|
`boolean` = `true`
|
|
392
392
|
|
|
@@ -404,9 +404,9 @@ An error if the option is invalid.
|
|
|
404
404
|
|
|
405
405
|
***
|
|
406
406
|
|
|
407
|
-
### base64()
|
|
407
|
+
### base64() {#base64}
|
|
408
408
|
|
|
409
|
-
> `static` **base64**(`optionName`, `optionValue`, `allowEnvVar
|
|
409
|
+
> `static` **base64**(`optionName`, `optionValue`, `allowEnvVar?`): `Uint8Array`
|
|
410
410
|
|
|
411
411
|
Check the option to see if it exists and is base64.
|
|
412
412
|
|
|
@@ -424,7 +424,7 @@ The option value.
|
|
|
424
424
|
|
|
425
425
|
`string` | `undefined`
|
|
426
426
|
|
|
427
|
-
##### allowEnvVar
|
|
427
|
+
##### allowEnvVar?
|
|
428
428
|
|
|
429
429
|
`boolean` = `true`
|
|
430
430
|
|
|
@@ -442,9 +442,9 @@ An error if the option is invalid.
|
|
|
442
442
|
|
|
443
443
|
***
|
|
444
444
|
|
|
445
|
-
### hexBase64()
|
|
445
|
+
### hexBase64() {#hexbase64}
|
|
446
446
|
|
|
447
|
-
> `static` **hexBase64**(`optionName`, `optionValue`, `allowEnvVar
|
|
447
|
+
> `static` **hexBase64**(`optionName`, `optionValue`, `allowEnvVar?`): `Uint8Array`
|
|
448
448
|
|
|
449
449
|
Check the option to see if it exists and is hex or base64.
|
|
450
450
|
|
|
@@ -462,7 +462,7 @@ The option value.
|
|
|
462
462
|
|
|
463
463
|
`string` | `undefined`
|
|
464
464
|
|
|
465
|
-
##### allowEnvVar
|
|
465
|
+
##### allowEnvVar?
|
|
466
466
|
|
|
467
467
|
`boolean` = `true`
|
|
468
468
|
|
|
@@ -14,7 +14,7 @@ Utilities function for helping in the CLI.
|
|
|
14
14
|
|
|
15
15
|
## Methods
|
|
16
16
|
|
|
17
|
-
### fileExists()
|
|
17
|
+
### fileExists() {#fileexists}
|
|
18
18
|
|
|
19
19
|
> `static` **fileExists**(`filename`): `Promise`\<`boolean`\>
|
|
20
20
|
|
|
@@ -36,7 +36,7 @@ True if the file exists.
|
|
|
36
36
|
|
|
37
37
|
***
|
|
38
38
|
|
|
39
|
-
### fileExistsSync()
|
|
39
|
+
### fileExistsSync() {#fileexistssync}
|
|
40
40
|
|
|
41
41
|
> `static` **fileExistsSync**(`filename`): `boolean`
|
|
42
42
|
|
|
@@ -58,7 +58,7 @@ True if the file exists.
|
|
|
58
58
|
|
|
59
59
|
***
|
|
60
60
|
|
|
61
|
-
### dirExists()
|
|
61
|
+
### dirExists() {#direxists}
|
|
62
62
|
|
|
63
63
|
> `static` **dirExists**(`dir`): `Promise`\<`boolean`\>
|
|
64
64
|
|
|
@@ -80,7 +80,7 @@ True if the dir exists.
|
|
|
80
80
|
|
|
81
81
|
***
|
|
82
82
|
|
|
83
|
-
### dirExistsSync()
|
|
83
|
+
### dirExistsSync() {#direxistssync}
|
|
84
84
|
|
|
85
85
|
> `static` **dirExistsSync**(`dir`): `boolean`
|
|
86
86
|
|
|
@@ -102,7 +102,7 @@ True if the dir exists.
|
|
|
102
102
|
|
|
103
103
|
***
|
|
104
104
|
|
|
105
|
-
### readJsonFile()
|
|
105
|
+
### readJsonFile() {#readjsonfile}
|
|
106
106
|
|
|
107
107
|
> `static` **readJsonFile**\<`T`\>(`filename`): `Promise`\<`T` \| `undefined`\>
|
|
108
108
|
|
|
@@ -130,7 +130,7 @@ The parsed JSON.
|
|
|
130
130
|
|
|
131
131
|
***
|
|
132
132
|
|
|
133
|
-
### readJsonFileSync()
|
|
133
|
+
### readJsonFileSync() {#readjsonfilesync}
|
|
134
134
|
|
|
135
135
|
> `static` **readJsonFileSync**\<`T`\>(`filename`): `T` \| `undefined`
|
|
136
136
|
|
|
@@ -158,7 +158,7 @@ The parsed JSON.
|
|
|
158
158
|
|
|
159
159
|
***
|
|
160
160
|
|
|
161
|
-
### readLinesFile()
|
|
161
|
+
### readLinesFile() {#readlinesfile}
|
|
162
162
|
|
|
163
163
|
> `static` **readLinesFile**(`filename`): `Promise`\<`string`[] \| `undefined`\>
|
|
164
164
|
|
|
@@ -180,7 +180,7 @@ The lines.
|
|
|
180
180
|
|
|
181
181
|
***
|
|
182
182
|
|
|
183
|
-
### readLinesFileSync()
|
|
183
|
+
### readLinesFileSync() {#readlinesfilesync}
|
|
184
184
|
|
|
185
185
|
> `static` **readLinesFileSync**(`filename`): `string`[] \| `undefined`
|
|
186
186
|
|
|
@@ -202,7 +202,7 @@ The lines.
|
|
|
202
202
|
|
|
203
203
|
***
|
|
204
204
|
|
|
205
|
-
### findNpmRoot()
|
|
205
|
+
### findNpmRoot() {#findnpmroot}
|
|
206
206
|
|
|
207
207
|
> `static` **findNpmRoot**(`rootFolder`): `Promise`\<`string`\>
|
|
208
208
|
|
|
@@ -224,7 +224,7 @@ The root path.
|
|
|
224
224
|
|
|
225
225
|
***
|
|
226
226
|
|
|
227
|
-
### runShellCmd()
|
|
227
|
+
### runShellCmd() {#runshellcmd}
|
|
228
228
|
|
|
229
229
|
> `static` **runShellCmd**(`command`, `args`, `cwd`): `Promise`\<`void`\>
|
|
230
230
|
|
|
@@ -258,7 +258,7 @@ Promise to wait for command execution to complete.
|
|
|
258
258
|
|
|
259
259
|
***
|
|
260
260
|
|
|
261
|
-
### runShellApp()
|
|
261
|
+
### runShellApp() {#runshellapp}
|
|
262
262
|
|
|
263
263
|
> `static` **runShellApp**(`app`, `args`, `cwd`): `Promise`\<`void`\>
|
|
264
264
|
|
|
@@ -292,7 +292,7 @@ Promise to wait for command execution to complete.
|
|
|
292
292
|
|
|
293
293
|
***
|
|
294
294
|
|
|
295
|
-
### writeJsonFile()
|
|
295
|
+
### writeJsonFile() {#writejsonfile}
|
|
296
296
|
|
|
297
297
|
> `static` **writeJsonFile**\<`T`\>(`jsonFilename`, `data`, `append`): `Promise`\<`void`\>
|
|
298
298
|
|
|
@@ -330,7 +330,7 @@ Append to the file.
|
|
|
330
330
|
|
|
331
331
|
***
|
|
332
332
|
|
|
333
|
-
### writeEnvFile()
|
|
333
|
+
### writeEnvFile() {#writeenvfile}
|
|
334
334
|
|
|
335
335
|
> `static` **writeEnvFile**(`envFilename`, `data`, `append`): `Promise`\<`void`\>
|
|
336
336
|
|
|
@@ -4,7 +4,7 @@ Options for the CLI.
|
|
|
4
4
|
|
|
5
5
|
## Properties
|
|
6
6
|
|
|
7
|
-
### title
|
|
7
|
+
### title {#title}
|
|
8
8
|
|
|
9
9
|
> **title**: `string`
|
|
10
10
|
|
|
@@ -12,7 +12,7 @@ The title of the CLI.
|
|
|
12
12
|
|
|
13
13
|
***
|
|
14
14
|
|
|
15
|
-
### appName
|
|
15
|
+
### appName {#appname}
|
|
16
16
|
|
|
17
17
|
> **appName**: `string`
|
|
18
18
|
|
|
@@ -20,7 +20,7 @@ The name of the app used to execute it.
|
|
|
20
20
|
|
|
21
21
|
***
|
|
22
22
|
|
|
23
|
-
### version
|
|
23
|
+
### version {#version}
|
|
24
24
|
|
|
25
25
|
> **version**: `string`
|
|
26
26
|
|
|
@@ -28,7 +28,7 @@ The version of the app.
|
|
|
28
28
|
|
|
29
29
|
***
|
|
30
30
|
|
|
31
|
-
### icon
|
|
31
|
+
### icon {#icon}
|
|
32
32
|
|
|
33
33
|
> **icon**: `string`
|
|
34
34
|
|
|
@@ -36,7 +36,7 @@ The icon for the CLI as an emoji character.
|
|
|
36
36
|
|
|
37
37
|
***
|
|
38
38
|
|
|
39
|
-
### supportsLang?
|
|
39
|
+
### supportsLang? {#supportslang}
|
|
40
40
|
|
|
41
41
|
> `optional` **supportsLang**: `boolean`
|
|
42
42
|
|
|
@@ -44,7 +44,7 @@ Supports different languages.
|
|
|
44
44
|
|
|
45
45
|
***
|
|
46
46
|
|
|
47
|
-
### supportsEnvFiles?
|
|
47
|
+
### supportsEnvFiles? {#supportsenvfiles}
|
|
48
48
|
|
|
49
49
|
> `optional` **supportsEnvFiles**: `boolean`
|
|
50
50
|
|
|
@@ -52,7 +52,7 @@ Supports the loading of env files.
|
|
|
52
52
|
|
|
53
53
|
***
|
|
54
54
|
|
|
55
|
-
### overrideOutputWidth?
|
|
55
|
+
### overrideOutputWidth? {#overrideoutputwidth}
|
|
56
56
|
|
|
57
57
|
> `optional` **overrideOutputWidth**: `number`
|
|
58
58
|
|
|
@@ -60,7 +60,7 @@ Override the default output width.
|
|
|
60
60
|
|
|
61
61
|
***
|
|
62
62
|
|
|
63
|
-
### showDevToolWarning?
|
|
63
|
+
### showDevToolWarning? {#showdevtoolwarning}
|
|
64
64
|
|
|
65
65
|
> `optional` **showDevToolWarning**: `boolean`
|
|
66
66
|
|
|
@@ -4,7 +4,7 @@ Options for the CLI Output for env.
|
|
|
4
4
|
|
|
5
5
|
## Properties
|
|
6
6
|
|
|
7
|
-
### env?
|
|
7
|
+
### env? {#env}
|
|
8
8
|
|
|
9
9
|
> `optional` **env**: `string`
|
|
10
10
|
|
|
@@ -12,7 +12,7 @@ Output the data to an environment file.
|
|
|
12
12
|
|
|
13
13
|
***
|
|
14
14
|
|
|
15
|
-
### mergeEnv
|
|
15
|
+
### mergeEnv {#mergeenv}
|
|
16
16
|
|
|
17
17
|
> **mergeEnv**: `boolean`
|
|
18
18
|
|
|
@@ -4,7 +4,7 @@ Options for the CLI Output for JSON.
|
|
|
4
4
|
|
|
5
5
|
## Properties
|
|
6
6
|
|
|
7
|
-
### json?
|
|
7
|
+
### json? {#json}
|
|
8
8
|
|
|
9
9
|
> `optional` **json**: `string`
|
|
10
10
|
|
|
@@ -12,7 +12,7 @@ Output the data to an JSON file.
|
|
|
12
12
|
|
|
13
13
|
***
|
|
14
14
|
|
|
15
|
-
### mergeJson
|
|
15
|
+
### mergeJson {#mergejson}
|
|
16
16
|
|
|
17
17
|
> **mergeJson**: `boolean`
|
|
18
18
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/cli-core",
|
|
3
|
-
"version": "0.0.3-next.
|
|
3
|
+
"version": "0.0.3-next.23",
|
|
4
4
|
"description": "Core classes for building a CLI",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
"node": ">=20.0.0"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@twin.org/core": "0.0.3-next.
|
|
18
|
-
"@twin.org/nameof": "0.0.3-next.
|
|
17
|
+
"@twin.org/core": "0.0.3-next.23",
|
|
18
|
+
"@twin.org/nameof": "0.0.3-next.23",
|
|
19
19
|
"chalk": "5.6.2",
|
|
20
|
-
"commander": "14.0.
|
|
21
|
-
"dotenv": "17.
|
|
20
|
+
"commander": "14.0.3",
|
|
21
|
+
"dotenv": "17.3.1"
|
|
22
22
|
},
|
|
23
23
|
"main": "./dist/es/index.js",
|
|
24
24
|
"types": "./dist/types/index.d.ts",
|