@twin.org/cli-core 0.0.3-next.8 → 0.0.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/README.md +2 -2
- package/dist/es/cliDisplay.js +23 -3
- package/dist/es/cliDisplay.js.map +1 -1
- package/dist/es/cliParam.js +3 -3
- package/dist/es/cliParam.js.map +1 -1
- package/dist/types/cliDisplay.d.ts +7 -1
- package/docs/changelog.md +858 -120
- package/docs/examples.md +82 -1
- package/docs/reference/classes/CLIBase.md +3 -3
- package/docs/reference/classes/CLIDisplay.md +43 -27
- package/docs/reference/classes/CLIOptions.md +1 -1
- package/docs/reference/classes/CLIParam.md +56 -56
- package/docs/reference/classes/CLIUtils.md +17 -17
- package/docs/reference/interfaces/ICliOptions.md +12 -12
- package/docs/reference/interfaces/ICliOutputOptionsConsole.md +1 -1
- package/docs/reference/interfaces/ICliOutputOptionsEnv.md +3 -3
- package/docs/reference/interfaces/ICliOutputOptionsJson.md +3 -3
- package/package.json +9 -8
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
|
|
|
@@ -24,9 +24,9 @@ The default output method for writing standard messages.
|
|
|
24
24
|
|
|
25
25
|
##### buffer
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
`string` \| `Uint8Array`\<`ArrayBufferLike`\>
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
The message to output.
|
|
30
30
|
|
|
31
31
|
#### Returns
|
|
32
32
|
|
|
@@ -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
|
|
|
@@ -44,9 +44,9 @@ The default output method for writing error messages.
|
|
|
44
44
|
|
|
45
45
|
##### buffer
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
`string` \| `Uint8Array`\<`ArrayBufferLike`\>
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
The message to output.
|
|
50
50
|
|
|
51
51
|
#### Returns
|
|
52
52
|
|
|
@@ -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`): `void`
|
|
103
|
+
> `static` **error**(`error`, `lineBreaks?`, `options?`): `void`
|
|
104
104
|
|
|
105
105
|
Display an error message.
|
|
106
106
|
|
|
@@ -112,19 +112,35 @@ 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
|
|
|
119
119
|
Whether to add a line break after the error.
|
|
120
120
|
|
|
121
|
+
##### options?
|
|
122
|
+
|
|
123
|
+
Options for formatting the error.
|
|
124
|
+
|
|
125
|
+
###### includeStack?
|
|
126
|
+
|
|
127
|
+
`boolean`
|
|
128
|
+
|
|
129
|
+
Whether to include the stack trace in the output, defaults to false.
|
|
130
|
+
|
|
131
|
+
###### includeAdditional?
|
|
132
|
+
|
|
133
|
+
`boolean`
|
|
134
|
+
|
|
135
|
+
Whether to include additional error information in the output, defaults to false.
|
|
136
|
+
|
|
121
137
|
#### Returns
|
|
122
138
|
|
|
123
139
|
`void`
|
|
124
140
|
|
|
125
141
|
***
|
|
126
142
|
|
|
127
|
-
### errorMessage()
|
|
143
|
+
### errorMessage() {#errormessage}
|
|
128
144
|
|
|
129
145
|
> `static` **errorMessage**(`error`): `void`
|
|
130
146
|
|
|
@@ -144,7 +160,7 @@ The error to display.
|
|
|
144
160
|
|
|
145
161
|
***
|
|
146
162
|
|
|
147
|
-
### section()
|
|
163
|
+
### section() {#section}
|
|
148
164
|
|
|
149
165
|
> `static` **section**(`label`): `void`
|
|
150
166
|
|
|
@@ -164,9 +180,9 @@ The label for the section.
|
|
|
164
180
|
|
|
165
181
|
***
|
|
166
182
|
|
|
167
|
-
### value()
|
|
183
|
+
### value() {#value}
|
|
168
184
|
|
|
169
|
-
> `static` **value**(`label`, `value`, `indentLevel
|
|
185
|
+
> `static` **value**(`label`, `value`, `indentLevel?`): `void`
|
|
170
186
|
|
|
171
187
|
Display a value with a label.
|
|
172
188
|
|
|
@@ -184,7 +200,7 @@ The label for the value.
|
|
|
184
200
|
|
|
185
201
|
The value to display.
|
|
186
202
|
|
|
187
|
-
##### indentLevel
|
|
203
|
+
##### indentLevel?
|
|
188
204
|
|
|
189
205
|
`number` = `0`
|
|
190
206
|
|
|
@@ -196,7 +212,7 @@ The level of indentation.
|
|
|
196
212
|
|
|
197
213
|
***
|
|
198
214
|
|
|
199
|
-
### task()
|
|
215
|
+
### task() {#task}
|
|
200
216
|
|
|
201
217
|
> `static` **task**(`label`, `task?`): `void`
|
|
202
218
|
|
|
@@ -222,7 +238,7 @@ The task to display.
|
|
|
222
238
|
|
|
223
239
|
***
|
|
224
240
|
|
|
225
|
-
### break()
|
|
241
|
+
### break() {#break}
|
|
226
242
|
|
|
227
243
|
> `static` **break**(): `void`
|
|
228
244
|
|
|
@@ -234,7 +250,7 @@ Display a break.
|
|
|
234
250
|
|
|
235
251
|
***
|
|
236
252
|
|
|
237
|
-
### json()
|
|
253
|
+
### json() {#json}
|
|
238
254
|
|
|
239
255
|
> `static` **json**(`obj`): `void`
|
|
240
256
|
|
|
@@ -254,7 +270,7 @@ The object to display.
|
|
|
254
270
|
|
|
255
271
|
***
|
|
256
272
|
|
|
257
|
-
### warning()
|
|
273
|
+
### warning() {#warning}
|
|
258
274
|
|
|
259
275
|
> `static` **warning**(`label`): `void`
|
|
260
276
|
|
|
@@ -274,7 +290,7 @@ The label for the warning.
|
|
|
274
290
|
|
|
275
291
|
***
|
|
276
292
|
|
|
277
|
-
### done()
|
|
293
|
+
### done() {#done}
|
|
278
294
|
|
|
279
295
|
> `static` **done**(): `void`
|
|
280
296
|
|
|
@@ -286,27 +302,27 @@ Display the processing is done.
|
|
|
286
302
|
|
|
287
303
|
***
|
|
288
304
|
|
|
289
|
-
### spinnerStart()
|
|
305
|
+
### spinnerStart() {#spinnerstart}
|
|
290
306
|
|
|
291
|
-
> `static` **spinnerStart**(`i18nMessage
|
|
307
|
+
> `static` **spinnerStart**(`i18nMessage?`, `spinnerCharacters?`, `interval?`): `void`
|
|
292
308
|
|
|
293
309
|
Start the spinner.
|
|
294
310
|
|
|
295
311
|
#### Parameters
|
|
296
312
|
|
|
297
|
-
##### i18nMessage
|
|
313
|
+
##### i18nMessage?
|
|
298
314
|
|
|
299
315
|
`string` = `"cli.progress.pleaseWait"`
|
|
300
316
|
|
|
301
317
|
The message to display with the spinner.
|
|
302
318
|
|
|
303
|
-
##### spinnerCharacters
|
|
319
|
+
##### spinnerCharacters?
|
|
304
320
|
|
|
305
321
|
`string`[] = `...`
|
|
306
322
|
|
|
307
323
|
The characters to use in the spinner.
|
|
308
324
|
|
|
309
|
-
##### interval
|
|
325
|
+
##### interval?
|
|
310
326
|
|
|
311
327
|
`number` = `100`
|
|
312
328
|
|
|
@@ -318,7 +334,7 @@ The interval for the spinner.
|
|
|
318
334
|
|
|
319
335
|
***
|
|
320
336
|
|
|
321
|
-
### spinnerStop()
|
|
337
|
+
### spinnerStop() {#spinnerstop}
|
|
322
338
|
|
|
323
339
|
> `static` **spinnerStop**(): `void`
|
|
324
340
|
|
|
@@ -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
|
|
|
@@ -30,9 +30,9 @@ The name of the option.
|
|
|
30
30
|
|
|
31
31
|
##### optionValue
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
`string` \| `undefined`
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
The option value.
|
|
36
36
|
|
|
37
37
|
##### allowEnvVar
|
|
38
38
|
|
|
@@ -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
|
|
|
@@ -68,11 +68,11 @@ The name of the option.
|
|
|
68
68
|
|
|
69
69
|
##### optionValue
|
|
70
70
|
|
|
71
|
+
`string` \| `undefined`
|
|
72
|
+
|
|
71
73
|
The option value.
|
|
72
74
|
|
|
73
|
-
|
|
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
|
|
|
@@ -112,9 +112,9 @@ The name of the option.
|
|
|
112
112
|
|
|
113
113
|
##### optionValue
|
|
114
114
|
|
|
115
|
-
|
|
115
|
+
`string` \| `undefined`
|
|
116
116
|
|
|
117
|
-
|
|
117
|
+
The option value.
|
|
118
118
|
|
|
119
119
|
##### validValues
|
|
120
120
|
|
|
@@ -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
|
|
|
@@ -156,11 +156,11 @@ The name of the option.
|
|
|
156
156
|
|
|
157
157
|
##### optionValue
|
|
158
158
|
|
|
159
|
-
|
|
159
|
+
`string` \| `undefined`
|
|
160
160
|
|
|
161
|
-
|
|
161
|
+
The option value.
|
|
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
|
|
|
@@ -194,17 +194,17 @@ The name of the option.
|
|
|
194
194
|
|
|
195
195
|
##### optionValue
|
|
196
196
|
|
|
197
|
-
|
|
197
|
+
`string` \| `undefined`
|
|
198
198
|
|
|
199
|
-
|
|
199
|
+
The option value.
|
|
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
|
|
|
@@ -244,17 +244,17 @@ The name of the option.
|
|
|
244
244
|
|
|
245
245
|
##### optionValue
|
|
246
246
|
|
|
247
|
+
`string` \| `undefined`
|
|
248
|
+
|
|
247
249
|
The option value.
|
|
248
250
|
|
|
249
|
-
|
|
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
|
|
|
@@ -294,17 +294,17 @@ The name of the option.
|
|
|
294
294
|
|
|
295
295
|
##### optionValue
|
|
296
296
|
|
|
297
|
-
|
|
297
|
+
`string` \| `undefined`
|
|
298
298
|
|
|
299
|
-
|
|
299
|
+
The option value.
|
|
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
|
|
|
@@ -344,11 +344,11 @@ The name of the option.
|
|
|
344
344
|
|
|
345
345
|
##### optionValue
|
|
346
346
|
|
|
347
|
-
|
|
347
|
+
`string` \| `undefined`
|
|
348
348
|
|
|
349
|
-
|
|
349
|
+
The option value.
|
|
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
|
|
|
@@ -382,11 +382,11 @@ The name of the option.
|
|
|
382
382
|
|
|
383
383
|
##### optionValue
|
|
384
384
|
|
|
385
|
-
|
|
385
|
+
`string` \| `undefined`
|
|
386
386
|
|
|
387
|
-
|
|
387
|
+
The option value.
|
|
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
|
|
|
@@ -420,11 +420,11 @@ The name of the option.
|
|
|
420
420
|
|
|
421
421
|
##### optionValue
|
|
422
422
|
|
|
423
|
-
|
|
423
|
+
`string` \| `undefined`
|
|
424
424
|
|
|
425
|
-
|
|
425
|
+
The option value.
|
|
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
|
|
|
@@ -458,11 +458,11 @@ The name of the option.
|
|
|
458
458
|
|
|
459
459
|
##### optionValue
|
|
460
460
|
|
|
461
|
-
|
|
461
|
+
`string` \| `undefined`
|
|
462
462
|
|
|
463
|
-
|
|
463
|
+
The option value.
|
|
464
464
|
|
|
465
|
-
##### allowEnvVar
|
|
465
|
+
##### allowEnvVar?
|
|
466
466
|
|
|
467
467
|
`boolean` = `true`
|
|
468
468
|
|