@twin.org/cli-core 0.0.1-next.1
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/LICENSE +201 -0
- package/README.md +21 -0
- package/dist/cjs/index.cjs +848 -0
- package/dist/esm/index.mjs +819 -0
- package/dist/types/cliBase.d.ts +26 -0
- package/dist/types/cliDisplay.d.ts +74 -0
- package/dist/types/cliOptions.d.ts +23 -0
- package/dist/types/cliParam.d.ts +110 -0
- package/dist/types/cliUtils.d.ts +81 -0
- package/dist/types/commands/global.d.ts +13 -0
- package/dist/types/index.d.ts +11 -0
- package/dist/types/models/ICliOptions.d.ts +29 -0
- package/dist/types/models/ICliOutputOptionsConsole.d.ts +9 -0
- package/dist/types/models/ICliOutputOptionsEnv.d.ts +13 -0
- package/dist/types/models/ICliOutputOptionsJson.d.ts +13 -0
- package/dist/types/models/cliOutputOptions.d.ts +7 -0
- package/docs/changelog.md +5 -0
- package/docs/examples.md +1 -0
- package/docs/reference/classes/CLIBase.md +83 -0
- package/docs/reference/classes/CLIDisplay.md +259 -0
- package/docs/reference/classes/CLIOptions.md +59 -0
- package/docs/reference/classes/CLIParam.md +393 -0
- package/docs/reference/classes/CLIUtils.md +289 -0
- package/docs/reference/functions/addGlobalOptions.md +27 -0
- package/docs/reference/functions/initGlobalOptions.md +19 -0
- package/docs/reference/globals.md +29 -0
- package/docs/reference/interfaces/ICliOptions.md +55 -0
- package/docs/reference/interfaces/ICliOutputOptionsConsole.md +15 -0
- package/docs/reference/interfaces/ICliOutputOptionsEnv.md +23 -0
- package/docs/reference/interfaces/ICliOutputOptionsJson.md +23 -0
- package/docs/reference/type-aliases/CliOutputOptions.md +9 -0
- package/locales/en.json +57 -0
- package/package.json +70 -0
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
[**@twin.org/cli-core**](../overview.md) • **Docs**
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
# Class: CLIDisplay
|
|
6
|
+
|
|
7
|
+
Display utilities for the CLI.
|
|
8
|
+
|
|
9
|
+
## Constructors
|
|
10
|
+
|
|
11
|
+
### new CLIDisplay()
|
|
12
|
+
|
|
13
|
+
> **new CLIDisplay**(): [`CLIDisplay`](CLIDisplay.md)
|
|
14
|
+
|
|
15
|
+
#### Returns
|
|
16
|
+
|
|
17
|
+
[`CLIDisplay`](CLIDisplay.md)
|
|
18
|
+
|
|
19
|
+
## Properties
|
|
20
|
+
|
|
21
|
+
### write()
|
|
22
|
+
|
|
23
|
+
> `static` **write**: (`buffer`) => `void`
|
|
24
|
+
|
|
25
|
+
The default output method for writing standard messages.
|
|
26
|
+
|
|
27
|
+
#### Parameters
|
|
28
|
+
|
|
29
|
+
• **buffer**: `string` \| `Uint8Array`
|
|
30
|
+
|
|
31
|
+
The message to output.
|
|
32
|
+
|
|
33
|
+
#### Returns
|
|
34
|
+
|
|
35
|
+
`void`
|
|
36
|
+
|
|
37
|
+
***
|
|
38
|
+
|
|
39
|
+
### writeError()
|
|
40
|
+
|
|
41
|
+
> `static` **writeError**: (`buffer`) => `void`
|
|
42
|
+
|
|
43
|
+
The default output method for writing error messages.
|
|
44
|
+
|
|
45
|
+
#### Parameters
|
|
46
|
+
|
|
47
|
+
• **buffer**: `string` \| `Uint8Array`
|
|
48
|
+
|
|
49
|
+
The message to output.
|
|
50
|
+
|
|
51
|
+
#### Returns
|
|
52
|
+
|
|
53
|
+
`void`
|
|
54
|
+
|
|
55
|
+
***
|
|
56
|
+
|
|
57
|
+
### clearLine()
|
|
58
|
+
|
|
59
|
+
> `static` **clearLine**: () => `void`
|
|
60
|
+
|
|
61
|
+
The default output method for clearing the current line.
|
|
62
|
+
|
|
63
|
+
#### Returns
|
|
64
|
+
|
|
65
|
+
`void`
|
|
66
|
+
|
|
67
|
+
## Methods
|
|
68
|
+
|
|
69
|
+
### header()
|
|
70
|
+
|
|
71
|
+
> `static` **header**(`title`, `version`, `icon`): `void`
|
|
72
|
+
|
|
73
|
+
Display the header for the CLI.
|
|
74
|
+
|
|
75
|
+
#### Parameters
|
|
76
|
+
|
|
77
|
+
• **title**: `string`
|
|
78
|
+
|
|
79
|
+
The title of the CLI.
|
|
80
|
+
|
|
81
|
+
• **version**: `string`
|
|
82
|
+
|
|
83
|
+
The version of the CLI.
|
|
84
|
+
|
|
85
|
+
• **icon**: `string`
|
|
86
|
+
|
|
87
|
+
The icon for the CLI.
|
|
88
|
+
|
|
89
|
+
#### Returns
|
|
90
|
+
|
|
91
|
+
`void`
|
|
92
|
+
|
|
93
|
+
***
|
|
94
|
+
|
|
95
|
+
### error()
|
|
96
|
+
|
|
97
|
+
> `static` **error**(`error`, `lineBreaks`): `void`
|
|
98
|
+
|
|
99
|
+
Display an error message.
|
|
100
|
+
|
|
101
|
+
#### Parameters
|
|
102
|
+
|
|
103
|
+
• **error**: `unknown`
|
|
104
|
+
|
|
105
|
+
The error to display.
|
|
106
|
+
|
|
107
|
+
• **lineBreaks**: `boolean`= `true`
|
|
108
|
+
|
|
109
|
+
Whether to add a line break after the error.
|
|
110
|
+
|
|
111
|
+
#### Returns
|
|
112
|
+
|
|
113
|
+
`void`
|
|
114
|
+
|
|
115
|
+
***
|
|
116
|
+
|
|
117
|
+
### section()
|
|
118
|
+
|
|
119
|
+
> `static` **section**(`label`): `void`
|
|
120
|
+
|
|
121
|
+
Display a section.
|
|
122
|
+
|
|
123
|
+
#### Parameters
|
|
124
|
+
|
|
125
|
+
• **label**: `string`
|
|
126
|
+
|
|
127
|
+
The label for the section.
|
|
128
|
+
|
|
129
|
+
#### Returns
|
|
130
|
+
|
|
131
|
+
`void`
|
|
132
|
+
|
|
133
|
+
***
|
|
134
|
+
|
|
135
|
+
### value()
|
|
136
|
+
|
|
137
|
+
> `static` **value**(`label`, `value`, `indentLevel`): `void`
|
|
138
|
+
|
|
139
|
+
Display a value with a label.
|
|
140
|
+
|
|
141
|
+
#### Parameters
|
|
142
|
+
|
|
143
|
+
• **label**: `string`
|
|
144
|
+
|
|
145
|
+
The label for the value.
|
|
146
|
+
|
|
147
|
+
• **value**: `unknown`
|
|
148
|
+
|
|
149
|
+
The value to display.
|
|
150
|
+
|
|
151
|
+
• **indentLevel**: `number`= `0`
|
|
152
|
+
|
|
153
|
+
The level of indentation.
|
|
154
|
+
|
|
155
|
+
#### Returns
|
|
156
|
+
|
|
157
|
+
`void`
|
|
158
|
+
|
|
159
|
+
***
|
|
160
|
+
|
|
161
|
+
### task()
|
|
162
|
+
|
|
163
|
+
> `static` **task**(`label`, `task`?): `void`
|
|
164
|
+
|
|
165
|
+
Display a task with a label.
|
|
166
|
+
|
|
167
|
+
#### Parameters
|
|
168
|
+
|
|
169
|
+
• **label**: `string`
|
|
170
|
+
|
|
171
|
+
The label for the value.
|
|
172
|
+
|
|
173
|
+
• **task?**: `string`
|
|
174
|
+
|
|
175
|
+
The task to display.
|
|
176
|
+
|
|
177
|
+
#### Returns
|
|
178
|
+
|
|
179
|
+
`void`
|
|
180
|
+
|
|
181
|
+
***
|
|
182
|
+
|
|
183
|
+
### break()
|
|
184
|
+
|
|
185
|
+
> `static` **break**(): `void`
|
|
186
|
+
|
|
187
|
+
Display a break.
|
|
188
|
+
|
|
189
|
+
#### Returns
|
|
190
|
+
|
|
191
|
+
`void`
|
|
192
|
+
|
|
193
|
+
***
|
|
194
|
+
|
|
195
|
+
### json()
|
|
196
|
+
|
|
197
|
+
> `static` **json**(`obj`): `void`
|
|
198
|
+
|
|
199
|
+
Display formatted and colorized JSON.
|
|
200
|
+
|
|
201
|
+
#### Parameters
|
|
202
|
+
|
|
203
|
+
• **obj**: `unknown`
|
|
204
|
+
|
|
205
|
+
The object to display.
|
|
206
|
+
|
|
207
|
+
#### Returns
|
|
208
|
+
|
|
209
|
+
`void`
|
|
210
|
+
|
|
211
|
+
***
|
|
212
|
+
|
|
213
|
+
### done()
|
|
214
|
+
|
|
215
|
+
> `static` **done**(): `void`
|
|
216
|
+
|
|
217
|
+
Display the processing is done.
|
|
218
|
+
|
|
219
|
+
#### Returns
|
|
220
|
+
|
|
221
|
+
`void`
|
|
222
|
+
|
|
223
|
+
***
|
|
224
|
+
|
|
225
|
+
### spinnerStart()
|
|
226
|
+
|
|
227
|
+
> `static` **spinnerStart**(`i18nMessage`, `spinnerCharacters`, `interval`): `void`
|
|
228
|
+
|
|
229
|
+
Start the spinner.
|
|
230
|
+
|
|
231
|
+
#### Parameters
|
|
232
|
+
|
|
233
|
+
• **i18nMessage**: `string`= `"cli.progress.pleaseWait"`
|
|
234
|
+
|
|
235
|
+
The message to display with the spinner.
|
|
236
|
+
|
|
237
|
+
• **spinnerCharacters**: `string`[]= `undefined`
|
|
238
|
+
|
|
239
|
+
The characters to use in the spinner.
|
|
240
|
+
|
|
241
|
+
• **interval**: `number`= `100`
|
|
242
|
+
|
|
243
|
+
The interval for the spinner.
|
|
244
|
+
|
|
245
|
+
#### Returns
|
|
246
|
+
|
|
247
|
+
`void`
|
|
248
|
+
|
|
249
|
+
***
|
|
250
|
+
|
|
251
|
+
### spinnerStop()
|
|
252
|
+
|
|
253
|
+
> `static` **spinnerStop**(): `void`
|
|
254
|
+
|
|
255
|
+
Stop the spinner.
|
|
256
|
+
|
|
257
|
+
#### Returns
|
|
258
|
+
|
|
259
|
+
`void`
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
[**@twin.org/cli-core**](../overview.md) • **Docs**
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
# Class: CLIOptions
|
|
6
|
+
|
|
7
|
+
Utilities for getting standard options.
|
|
8
|
+
|
|
9
|
+
## Constructors
|
|
10
|
+
|
|
11
|
+
### new CLIOptions()
|
|
12
|
+
|
|
13
|
+
> **new CLIOptions**(): [`CLIOptions`](CLIOptions.md)
|
|
14
|
+
|
|
15
|
+
#### Returns
|
|
16
|
+
|
|
17
|
+
[`CLIOptions`](CLIOptions.md)
|
|
18
|
+
|
|
19
|
+
## Methods
|
|
20
|
+
|
|
21
|
+
### output()
|
|
22
|
+
|
|
23
|
+
> `static` **output**(`command`, `opts`): `void`
|
|
24
|
+
|
|
25
|
+
Get the options for output.
|
|
26
|
+
|
|
27
|
+
#### Parameters
|
|
28
|
+
|
|
29
|
+
• **command**: `Command`
|
|
30
|
+
|
|
31
|
+
The command to add the options to.
|
|
32
|
+
|
|
33
|
+
• **opts**
|
|
34
|
+
|
|
35
|
+
The options of what to include.
|
|
36
|
+
|
|
37
|
+
• **opts.noConsole**: `boolean`
|
|
38
|
+
|
|
39
|
+
Do not output to the console.
|
|
40
|
+
|
|
41
|
+
• **opts.json**: `boolean`
|
|
42
|
+
|
|
43
|
+
Output to a JSON file.
|
|
44
|
+
|
|
45
|
+
• **opts.env**: `boolean`
|
|
46
|
+
|
|
47
|
+
Output to an environment file.
|
|
48
|
+
|
|
49
|
+
• **opts.mergeJson**: `boolean`
|
|
50
|
+
|
|
51
|
+
Merge existing JSON file.
|
|
52
|
+
|
|
53
|
+
• **opts.mergeEnv**: `boolean`
|
|
54
|
+
|
|
55
|
+
Merge existing environment file.
|
|
56
|
+
|
|
57
|
+
#### Returns
|
|
58
|
+
|
|
59
|
+
`void`
|
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
[**@twin.org/cli-core**](../overview.md) • **Docs**
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
# Class: CLIParam
|
|
6
|
+
|
|
7
|
+
Parameter utilities for the CLI.
|
|
8
|
+
|
|
9
|
+
## Constructors
|
|
10
|
+
|
|
11
|
+
### new CLIParam()
|
|
12
|
+
|
|
13
|
+
> **new CLIParam**(): [`CLIParam`](CLIParam.md)
|
|
14
|
+
|
|
15
|
+
#### Returns
|
|
16
|
+
|
|
17
|
+
[`CLIParam`](CLIParam.md)
|
|
18
|
+
|
|
19
|
+
## Methods
|
|
20
|
+
|
|
21
|
+
### env()
|
|
22
|
+
|
|
23
|
+
> `static` **env**(`optionName`, `optionValue`, `allowEnvVar`): `undefined` \| `string`
|
|
24
|
+
|
|
25
|
+
Check the option to see if it exists.
|
|
26
|
+
|
|
27
|
+
#### Parameters
|
|
28
|
+
|
|
29
|
+
• **optionName**: `string`
|
|
30
|
+
|
|
31
|
+
The name of the option.
|
|
32
|
+
|
|
33
|
+
• **optionValue**: `undefined` \| `string`
|
|
34
|
+
|
|
35
|
+
The option value.
|
|
36
|
+
|
|
37
|
+
• **allowEnvVar**: `boolean`
|
|
38
|
+
|
|
39
|
+
Allow the option to be read from an env var.
|
|
40
|
+
|
|
41
|
+
#### Returns
|
|
42
|
+
|
|
43
|
+
`undefined` \| `string`
|
|
44
|
+
|
|
45
|
+
The final option value.
|
|
46
|
+
|
|
47
|
+
#### Throws
|
|
48
|
+
|
|
49
|
+
An error if the option is invalid.
|
|
50
|
+
|
|
51
|
+
***
|
|
52
|
+
|
|
53
|
+
### stringValue()
|
|
54
|
+
|
|
55
|
+
> `static` **stringValue**(`optionName`, `optionValue`, `allowEnvVar`): `string`
|
|
56
|
+
|
|
57
|
+
Check the option to see if it exists.
|
|
58
|
+
|
|
59
|
+
#### Parameters
|
|
60
|
+
|
|
61
|
+
• **optionName**: `string`
|
|
62
|
+
|
|
63
|
+
The name of the option.
|
|
64
|
+
|
|
65
|
+
• **optionValue**: `undefined` \| `string`
|
|
66
|
+
|
|
67
|
+
The option value.
|
|
68
|
+
|
|
69
|
+
• **allowEnvVar**: `boolean`= `true`
|
|
70
|
+
|
|
71
|
+
Allow the option to be read from an env var.
|
|
72
|
+
|
|
73
|
+
#### Returns
|
|
74
|
+
|
|
75
|
+
`string`
|
|
76
|
+
|
|
77
|
+
The final option value.
|
|
78
|
+
|
|
79
|
+
#### Throws
|
|
80
|
+
|
|
81
|
+
An error if the option is invalid.
|
|
82
|
+
|
|
83
|
+
***
|
|
84
|
+
|
|
85
|
+
### url()
|
|
86
|
+
|
|
87
|
+
> `static` **url**(`optionName`, `optionValue`, `allowEnvVar`): `string`
|
|
88
|
+
|
|
89
|
+
Check the option to see if it a url.
|
|
90
|
+
|
|
91
|
+
#### Parameters
|
|
92
|
+
|
|
93
|
+
• **optionName**: `string`
|
|
94
|
+
|
|
95
|
+
The name of the option.
|
|
96
|
+
|
|
97
|
+
• **optionValue**: `undefined` \| `string`
|
|
98
|
+
|
|
99
|
+
The option value.
|
|
100
|
+
|
|
101
|
+
• **allowEnvVar**: `boolean`= `true`
|
|
102
|
+
|
|
103
|
+
Allow the option to be read from an env var.
|
|
104
|
+
|
|
105
|
+
#### Returns
|
|
106
|
+
|
|
107
|
+
`string`
|
|
108
|
+
|
|
109
|
+
The final option value.
|
|
110
|
+
|
|
111
|
+
#### Throws
|
|
112
|
+
|
|
113
|
+
An error if the option is invalid.
|
|
114
|
+
|
|
115
|
+
***
|
|
116
|
+
|
|
117
|
+
### number()
|
|
118
|
+
|
|
119
|
+
> `static` **number**(`optionName`, `optionValue`, `allowEnvVar`, `minValue`, `maxValue`?): `number`
|
|
120
|
+
|
|
121
|
+
Check the option to see if it exists and is a number.
|
|
122
|
+
|
|
123
|
+
#### Parameters
|
|
124
|
+
|
|
125
|
+
• **optionName**: `string`
|
|
126
|
+
|
|
127
|
+
The name of the option.
|
|
128
|
+
|
|
129
|
+
• **optionValue**: `undefined` \| `string`
|
|
130
|
+
|
|
131
|
+
The option value.
|
|
132
|
+
|
|
133
|
+
• **allowEnvVar**: `boolean`= `true`
|
|
134
|
+
|
|
135
|
+
Allow the option to be read from an env var.
|
|
136
|
+
|
|
137
|
+
• **minValue**: `number`= `0`
|
|
138
|
+
|
|
139
|
+
The minimum value.
|
|
140
|
+
|
|
141
|
+
• **maxValue?**: `number`
|
|
142
|
+
|
|
143
|
+
The maximum value.
|
|
144
|
+
|
|
145
|
+
#### Returns
|
|
146
|
+
|
|
147
|
+
`number`
|
|
148
|
+
|
|
149
|
+
The final option value.
|
|
150
|
+
|
|
151
|
+
#### Throws
|
|
152
|
+
|
|
153
|
+
An error if the option is invalid.
|
|
154
|
+
|
|
155
|
+
***
|
|
156
|
+
|
|
157
|
+
### integer()
|
|
158
|
+
|
|
159
|
+
> `static` **integer**(`optionName`, `optionValue`, `allowEnvVar`, `minValue`, `maxValue`?): `number`
|
|
160
|
+
|
|
161
|
+
Check the option to see if it exists and is an integer.
|
|
162
|
+
|
|
163
|
+
#### Parameters
|
|
164
|
+
|
|
165
|
+
• **optionName**: `string`
|
|
166
|
+
|
|
167
|
+
The name of the option.
|
|
168
|
+
|
|
169
|
+
• **optionValue**: `undefined` \| `string`
|
|
170
|
+
|
|
171
|
+
The option value.
|
|
172
|
+
|
|
173
|
+
• **allowEnvVar**: `boolean`= `true`
|
|
174
|
+
|
|
175
|
+
Allow the option to be read from an env var.
|
|
176
|
+
|
|
177
|
+
• **minValue**: `number`= `0`
|
|
178
|
+
|
|
179
|
+
The minimum value.
|
|
180
|
+
|
|
181
|
+
• **maxValue?**: `number`
|
|
182
|
+
|
|
183
|
+
The maximum value.
|
|
184
|
+
|
|
185
|
+
#### Returns
|
|
186
|
+
|
|
187
|
+
`number`
|
|
188
|
+
|
|
189
|
+
The final option value.
|
|
190
|
+
|
|
191
|
+
#### Throws
|
|
192
|
+
|
|
193
|
+
An error if the option is invalid.
|
|
194
|
+
|
|
195
|
+
***
|
|
196
|
+
|
|
197
|
+
### bigint()
|
|
198
|
+
|
|
199
|
+
> `static` **bigint**(`optionName`, `optionValue`, `allowEnvVar`, `minValue`, `maxValue`?): `bigint`
|
|
200
|
+
|
|
201
|
+
Check the option to see if it exists and is a big number.
|
|
202
|
+
|
|
203
|
+
#### Parameters
|
|
204
|
+
|
|
205
|
+
• **optionName**: `string`
|
|
206
|
+
|
|
207
|
+
The name of the option.
|
|
208
|
+
|
|
209
|
+
• **optionValue**: `undefined` \| `string`
|
|
210
|
+
|
|
211
|
+
The option value.
|
|
212
|
+
|
|
213
|
+
• **allowEnvVar**: `boolean`= `true`
|
|
214
|
+
|
|
215
|
+
Allow the option to be read from an env var.
|
|
216
|
+
|
|
217
|
+
• **minValue**: `bigint`= `undefined`
|
|
218
|
+
|
|
219
|
+
The minimum value.
|
|
220
|
+
|
|
221
|
+
• **maxValue?**: `bigint`
|
|
222
|
+
|
|
223
|
+
The maximum value.
|
|
224
|
+
|
|
225
|
+
#### Returns
|
|
226
|
+
|
|
227
|
+
`bigint`
|
|
228
|
+
|
|
229
|
+
The final option value.
|
|
230
|
+
|
|
231
|
+
#### Throws
|
|
232
|
+
|
|
233
|
+
An error if the option is invalid.
|
|
234
|
+
|
|
235
|
+
***
|
|
236
|
+
|
|
237
|
+
### boolean()
|
|
238
|
+
|
|
239
|
+
> `static` **boolean**(`optionName`, `optionValue`, `allowEnvVar`): `boolean`
|
|
240
|
+
|
|
241
|
+
Check the option to see if it exists and is a boolean.
|
|
242
|
+
|
|
243
|
+
#### Parameters
|
|
244
|
+
|
|
245
|
+
• **optionName**: `string`
|
|
246
|
+
|
|
247
|
+
The name of the option.
|
|
248
|
+
|
|
249
|
+
• **optionValue**: `undefined` \| `string`
|
|
250
|
+
|
|
251
|
+
The option value.
|
|
252
|
+
|
|
253
|
+
• **allowEnvVar**: `boolean`= `true`
|
|
254
|
+
|
|
255
|
+
Allow the option to be read from an env var.
|
|
256
|
+
|
|
257
|
+
#### Returns
|
|
258
|
+
|
|
259
|
+
`boolean`
|
|
260
|
+
|
|
261
|
+
The final option value.
|
|
262
|
+
|
|
263
|
+
#### Throws
|
|
264
|
+
|
|
265
|
+
An error if the option is invalid.
|
|
266
|
+
|
|
267
|
+
***
|
|
268
|
+
|
|
269
|
+
### hex()
|
|
270
|
+
|
|
271
|
+
> `static` **hex**(`optionName`, `optionValue`, `allowEnvVar`): `Uint8Array`
|
|
272
|
+
|
|
273
|
+
Check the option to see if it exists and is hex.
|
|
274
|
+
|
|
275
|
+
#### Parameters
|
|
276
|
+
|
|
277
|
+
• **optionName**: `string`
|
|
278
|
+
|
|
279
|
+
The name of the option.
|
|
280
|
+
|
|
281
|
+
• **optionValue**: `undefined` \| `string`
|
|
282
|
+
|
|
283
|
+
The option value.
|
|
284
|
+
|
|
285
|
+
• **allowEnvVar**: `boolean`= `true`
|
|
286
|
+
|
|
287
|
+
Allow the option to be read from an env var.
|
|
288
|
+
|
|
289
|
+
#### Returns
|
|
290
|
+
|
|
291
|
+
`Uint8Array`
|
|
292
|
+
|
|
293
|
+
The final option value.
|
|
294
|
+
|
|
295
|
+
#### Throws
|
|
296
|
+
|
|
297
|
+
An error if the option is invalid.
|
|
298
|
+
|
|
299
|
+
***
|
|
300
|
+
|
|
301
|
+
### base64()
|
|
302
|
+
|
|
303
|
+
> `static` **base64**(`optionName`, `optionValue`, `allowEnvVar`): `Uint8Array`
|
|
304
|
+
|
|
305
|
+
Check the option to see if it exists and is base64.
|
|
306
|
+
|
|
307
|
+
#### Parameters
|
|
308
|
+
|
|
309
|
+
• **optionName**: `string`
|
|
310
|
+
|
|
311
|
+
The name of the option.
|
|
312
|
+
|
|
313
|
+
• **optionValue**: `undefined` \| `string`
|
|
314
|
+
|
|
315
|
+
The option value.
|
|
316
|
+
|
|
317
|
+
• **allowEnvVar**: `boolean`= `true`
|
|
318
|
+
|
|
319
|
+
Allow the option to be read from an env var.
|
|
320
|
+
|
|
321
|
+
#### Returns
|
|
322
|
+
|
|
323
|
+
`Uint8Array`
|
|
324
|
+
|
|
325
|
+
The final option value.
|
|
326
|
+
|
|
327
|
+
#### Throws
|
|
328
|
+
|
|
329
|
+
An error if the option is invalid.
|
|
330
|
+
|
|
331
|
+
***
|
|
332
|
+
|
|
333
|
+
### hexBase64()
|
|
334
|
+
|
|
335
|
+
> `static` **hexBase64**(`optionName`, `optionValue`, `allowEnvVar`): `Uint8Array`
|
|
336
|
+
|
|
337
|
+
Check the option to see if it exists and is hex or base64.
|
|
338
|
+
|
|
339
|
+
#### Parameters
|
|
340
|
+
|
|
341
|
+
• **optionName**: `string`
|
|
342
|
+
|
|
343
|
+
The name of the option.
|
|
344
|
+
|
|
345
|
+
• **optionValue**: `undefined` \| `string`
|
|
346
|
+
|
|
347
|
+
The option value.
|
|
348
|
+
|
|
349
|
+
• **allowEnvVar**: `boolean`= `true`
|
|
350
|
+
|
|
351
|
+
Allow the option to be read from an env var.
|
|
352
|
+
|
|
353
|
+
#### Returns
|
|
354
|
+
|
|
355
|
+
`Uint8Array`
|
|
356
|
+
|
|
357
|
+
The final option value.
|
|
358
|
+
|
|
359
|
+
#### Throws
|
|
360
|
+
|
|
361
|
+
An error if the option is invalid.
|
|
362
|
+
|
|
363
|
+
***
|
|
364
|
+
|
|
365
|
+
### bech32()
|
|
366
|
+
|
|
367
|
+
> `static` **bech32**(`optionName`, `optionValue`, `allowEnvVar`): `string`
|
|
368
|
+
|
|
369
|
+
Check the option to see if it exists and is bech32.
|
|
370
|
+
|
|
371
|
+
#### Parameters
|
|
372
|
+
|
|
373
|
+
• **optionName**: `string`
|
|
374
|
+
|
|
375
|
+
The name of the option.
|
|
376
|
+
|
|
377
|
+
• **optionValue**: `undefined` \| `string`
|
|
378
|
+
|
|
379
|
+
The option value.
|
|
380
|
+
|
|
381
|
+
• **allowEnvVar**: `boolean`= `true`
|
|
382
|
+
|
|
383
|
+
Allow the option to be read from an env var.
|
|
384
|
+
|
|
385
|
+
#### Returns
|
|
386
|
+
|
|
387
|
+
`string`
|
|
388
|
+
|
|
389
|
+
The final option value.
|
|
390
|
+
|
|
391
|
+
#### Throws
|
|
392
|
+
|
|
393
|
+
An error if the option is invalid.
|