@twin.org/cli-core 0.0.1-next.6 → 0.0.1-next.60
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 +166 -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 +8 -8
package/dist/cjs/index.cjs
CHANGED
|
@@ -81,7 +81,7 @@ class CLIDisplay {
|
|
|
81
81
|
if (lineBreaks) {
|
|
82
82
|
CLIDisplay.writeError("\n");
|
|
83
83
|
}
|
|
84
|
-
const formatted = core.ErrorHelper.formatErrors(error);
|
|
84
|
+
const formatted = core.ErrorHelper.formatErrors(error, true);
|
|
85
85
|
CLIDisplay.writeError(chalk.red(formatted.map(e => `\t${e}`).join("\n")));
|
|
86
86
|
if (lineBreaks) {
|
|
87
87
|
CLIDisplay.writeError("\n");
|
|
@@ -298,6 +298,17 @@ class CLIUtils {
|
|
|
298
298
|
});
|
|
299
299
|
});
|
|
300
300
|
}
|
|
301
|
+
/**
|
|
302
|
+
* Run a shell command.
|
|
303
|
+
* @param command The app to run in the shell.
|
|
304
|
+
* @param args The args for the app.
|
|
305
|
+
* @param cwd The working directory to execute the command in.
|
|
306
|
+
* @returns Promise to wait for command execution to complete.
|
|
307
|
+
*/
|
|
308
|
+
static async runShellCmd(command, args, cwd) {
|
|
309
|
+
const osCommand = process.platform.startsWith("win") ? `${command}.cmd` : command;
|
|
310
|
+
return CLIUtils.runShellApp(osCommand, args, cwd);
|
|
311
|
+
}
|
|
301
312
|
/**
|
|
302
313
|
* Run a shell app.
|
|
303
314
|
* @param app The app to run in the shell.
|
|
@@ -305,10 +316,9 @@ class CLIUtils {
|
|
|
305
316
|
* @param cwd The working directory to execute the command in.
|
|
306
317
|
* @returns Promise to wait for command execution to complete.
|
|
307
318
|
*/
|
|
308
|
-
static async
|
|
319
|
+
static async runShellApp(app, args, cwd) {
|
|
309
320
|
return new Promise((resolve, reject) => {
|
|
310
|
-
const
|
|
311
|
-
const sp = node_child_process.spawn(osCommand, args, {
|
|
321
|
+
const sp = node_child_process.spawn(app, args, {
|
|
312
322
|
shell: true,
|
|
313
323
|
cwd
|
|
314
324
|
});
|
|
@@ -346,7 +356,7 @@ class CLIUtils {
|
|
|
346
356
|
CLIDisplay.task(core.I18n.formatMessage("cli.progress.writingJsonFile"), filename);
|
|
347
357
|
CLIDisplay.break();
|
|
348
358
|
await promises.mkdir(path.dirname(filename), { recursive: true });
|
|
349
|
-
await promises.writeFile(filename, JSON.stringify(core.ObjectHelper.merge(currentJson, data), undefined, "\t"));
|
|
359
|
+
await promises.writeFile(filename, `${JSON.stringify(core.ObjectHelper.merge(currentJson, data), undefined, "\t")}\n`);
|
|
350
360
|
}
|
|
351
361
|
}
|
|
352
362
|
/**
|
|
@@ -377,7 +387,7 @@ class CLIUtils {
|
|
|
377
387
|
for (const line of data) {
|
|
378
388
|
const parts = line.split("=");
|
|
379
389
|
const currentIndex = outputKeys.indexOf(parts[0]);
|
|
380
|
-
if (currentIndex
|
|
390
|
+
if (currentIndex !== -1) {
|
|
381
391
|
outputKeys.splice(currentIndex, 1);
|
|
382
392
|
}
|
|
383
393
|
outputKeys.push(parts[0]);
|
|
@@ -627,7 +637,7 @@ class CLIParam {
|
|
|
627
637
|
return optionValue;
|
|
628
638
|
}
|
|
629
639
|
/**
|
|
630
|
-
* Check the option to see if
|
|
640
|
+
* Check the option to see if the String exists.
|
|
631
641
|
* @param optionName The name of the option.
|
|
632
642
|
* @param optionValue The option value.
|
|
633
643
|
* @param allowEnvVar Allow the option to be read from an env var.
|
|
@@ -640,7 +650,7 @@ class CLIParam {
|
|
|
640
650
|
return optionValue;
|
|
641
651
|
}
|
|
642
652
|
/**
|
|
643
|
-
* Check the option to see if it a url.
|
|
653
|
+
* Check the option to see if it is a url.
|
|
644
654
|
* @param optionName The name of the option.
|
|
645
655
|
* @param optionValue The option value.
|
|
646
656
|
* @param allowEnvVar Allow the option to be read from an env var.
|
package/dist/esm/index.mjs
CHANGED
|
@@ -60,7 +60,7 @@ class CLIDisplay {
|
|
|
60
60
|
if (lineBreaks) {
|
|
61
61
|
CLIDisplay.writeError("\n");
|
|
62
62
|
}
|
|
63
|
-
const formatted = ErrorHelper.formatErrors(error);
|
|
63
|
+
const formatted = ErrorHelper.formatErrors(error, true);
|
|
64
64
|
CLIDisplay.writeError(chalk.red(formatted.map(e => `\t${e}`).join("\n")));
|
|
65
65
|
if (lineBreaks) {
|
|
66
66
|
CLIDisplay.writeError("\n");
|
|
@@ -277,6 +277,17 @@ class CLIUtils {
|
|
|
277
277
|
});
|
|
278
278
|
});
|
|
279
279
|
}
|
|
280
|
+
/**
|
|
281
|
+
* Run a shell command.
|
|
282
|
+
* @param command The app to run in the shell.
|
|
283
|
+
* @param args The args for the app.
|
|
284
|
+
* @param cwd The working directory to execute the command in.
|
|
285
|
+
* @returns Promise to wait for command execution to complete.
|
|
286
|
+
*/
|
|
287
|
+
static async runShellCmd(command, args, cwd) {
|
|
288
|
+
const osCommand = process.platform.startsWith("win") ? `${command}.cmd` : command;
|
|
289
|
+
return CLIUtils.runShellApp(osCommand, args, cwd);
|
|
290
|
+
}
|
|
280
291
|
/**
|
|
281
292
|
* Run a shell app.
|
|
282
293
|
* @param app The app to run in the shell.
|
|
@@ -284,10 +295,9 @@ class CLIUtils {
|
|
|
284
295
|
* @param cwd The working directory to execute the command in.
|
|
285
296
|
* @returns Promise to wait for command execution to complete.
|
|
286
297
|
*/
|
|
287
|
-
static async
|
|
298
|
+
static async runShellApp(app, args, cwd) {
|
|
288
299
|
return new Promise((resolve, reject) => {
|
|
289
|
-
const
|
|
290
|
-
const sp = spawn(osCommand, args, {
|
|
300
|
+
const sp = spawn(app, args, {
|
|
291
301
|
shell: true,
|
|
292
302
|
cwd
|
|
293
303
|
});
|
|
@@ -325,7 +335,7 @@ class CLIUtils {
|
|
|
325
335
|
CLIDisplay.task(I18n.formatMessage("cli.progress.writingJsonFile"), filename);
|
|
326
336
|
CLIDisplay.break();
|
|
327
337
|
await mkdir(path.dirname(filename), { recursive: true });
|
|
328
|
-
await writeFile(filename, JSON.stringify(ObjectHelper.merge(currentJson, data), undefined, "\t"));
|
|
338
|
+
await writeFile(filename, `${JSON.stringify(ObjectHelper.merge(currentJson, data), undefined, "\t")}\n`);
|
|
329
339
|
}
|
|
330
340
|
}
|
|
331
341
|
/**
|
|
@@ -356,7 +366,7 @@ class CLIUtils {
|
|
|
356
366
|
for (const line of data) {
|
|
357
367
|
const parts = line.split("=");
|
|
358
368
|
const currentIndex = outputKeys.indexOf(parts[0]);
|
|
359
|
-
if (currentIndex
|
|
369
|
+
if (currentIndex !== -1) {
|
|
360
370
|
outputKeys.splice(currentIndex, 1);
|
|
361
371
|
}
|
|
362
372
|
outputKeys.push(parts[0]);
|
|
@@ -606,7 +616,7 @@ class CLIParam {
|
|
|
606
616
|
return optionValue;
|
|
607
617
|
}
|
|
608
618
|
/**
|
|
609
|
-
* Check the option to see if
|
|
619
|
+
* Check the option to see if the String exists.
|
|
610
620
|
* @param optionName The name of the option.
|
|
611
621
|
* @param optionValue The option value.
|
|
612
622
|
* @param allowEnvVar Allow the option to be read from an env var.
|
|
@@ -619,7 +629,7 @@ class CLIParam {
|
|
|
619
629
|
return optionValue;
|
|
620
630
|
}
|
|
621
631
|
/**
|
|
622
|
-
* Check the option to see if it a url.
|
|
632
|
+
* Check the option to see if it is a url.
|
|
623
633
|
* @param optionName The name of the option.
|
|
624
634
|
* @param optionValue The option value.
|
|
625
635
|
* @param allowEnvVar Allow the option to be read from an env var.
|
package/dist/types/cliParam.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export declare class CLIParam {
|
|
|
12
12
|
*/
|
|
13
13
|
static env(optionName: string, optionValue: string | undefined, allowEnvVar: boolean): string | undefined;
|
|
14
14
|
/**
|
|
15
|
-
* Check the option to see if
|
|
15
|
+
* Check the option to see if the String exists.
|
|
16
16
|
* @param optionName The name of the option.
|
|
17
17
|
* @param optionValue The option value.
|
|
18
18
|
* @param allowEnvVar Allow the option to be read from an env var.
|
|
@@ -21,7 +21,7 @@ export declare class CLIParam {
|
|
|
21
21
|
*/
|
|
22
22
|
static stringValue(optionName: string, optionValue: string | undefined, allowEnvVar?: boolean): string;
|
|
23
23
|
/**
|
|
24
|
-
* Check the option to see if it a url.
|
|
24
|
+
* Check the option to see if it is a url.
|
|
25
25
|
* @param optionName The name of the option.
|
|
26
26
|
* @param optionValue The option value.
|
|
27
27
|
* @param allowEnvVar Allow the option to be read from an env var.
|
package/dist/types/cliUtils.d.ts
CHANGED
|
@@ -56,6 +56,14 @@ export declare class CLIUtils {
|
|
|
56
56
|
* @returns The root path.
|
|
57
57
|
*/
|
|
58
58
|
static findNpmRoot(rootFolder: string): Promise<string>;
|
|
59
|
+
/**
|
|
60
|
+
* Run a shell command.
|
|
61
|
+
* @param command The app to run in the shell.
|
|
62
|
+
* @param args The args for the app.
|
|
63
|
+
* @param cwd The working directory to execute the command in.
|
|
64
|
+
* @returns Promise to wait for command execution to complete.
|
|
65
|
+
*/
|
|
66
|
+
static runShellCmd(command: string, args: string[], cwd: string): Promise<void>;
|
|
59
67
|
/**
|
|
60
68
|
* Run a shell app.
|
|
61
69
|
* @param app The app to run in the shell.
|
|
@@ -63,7 +71,7 @@ export declare class CLIUtils {
|
|
|
63
71
|
* @param cwd The working directory to execute the command in.
|
|
64
72
|
* @returns Promise to wait for command execution to complete.
|
|
65
73
|
*/
|
|
66
|
-
static
|
|
74
|
+
static runShellApp(app: string, args: string[], cwd: string): Promise<void>;
|
|
67
75
|
/**
|
|
68
76
|
* Write a JSON file.
|
|
69
77
|
* @param jsonFilename The filename to write.
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,170 @@
|
|
|
1
1
|
# @twin.org/cli-core - Changelog
|
|
2
2
|
|
|
3
|
-
## 0.0.1-next.
|
|
3
|
+
## [0.0.1-next.60](https://github.com/twinfoundation/framework/compare/cli-core-v0.0.1-next.59...cli-core-v0.0.1-next.60) (2025-06-17)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* improve error display in CLI ([94b6ca8](https://github.com/twinfoundation/framework/commit/94b6ca8bdcfe3ca7671c4095b436ea7bddaae98e))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* The following workspace dependencies were updated
|
|
14
|
+
* dependencies
|
|
15
|
+
* @twin.org/core bumped from 0.0.1-next.59 to 0.0.1-next.60
|
|
16
|
+
* @twin.org/crypto bumped from 0.0.1-next.59 to 0.0.1-next.60
|
|
17
|
+
|
|
18
|
+
## [0.0.1-next.59](https://github.com/twinfoundation/framework/compare/cli-core-v0.0.1-next.58...cli-core-v0.0.1-next.59) (2025-06-17)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Miscellaneous Chores
|
|
22
|
+
|
|
23
|
+
* **cli-core:** Synchronize repo versions
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### Dependencies
|
|
27
|
+
|
|
28
|
+
* The following workspace dependencies were updated
|
|
29
|
+
* dependencies
|
|
30
|
+
* @twin.org/core bumped from 0.0.1-next.58 to 0.0.1-next.59
|
|
31
|
+
* @twin.org/crypto bumped from 0.0.1-next.58 to 0.0.1-next.59
|
|
32
|
+
|
|
33
|
+
## [0.0.1-next.58](https://github.com/twinfoundation/framework/compare/cli-core-v0.0.1-next.57...cli-core-v0.0.1-next.58) (2025-06-13)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
### Bug Fixes
|
|
37
|
+
|
|
38
|
+
* framework pr naming convention ([#142](https://github.com/twinfoundation/framework/issues/142)) ([e29acee](https://github.com/twinfoundation/framework/commit/e29acee2fbec42506091956d6ba8b8ce25a90008))
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
### Dependencies
|
|
42
|
+
|
|
43
|
+
* The following workspace dependencies were updated
|
|
44
|
+
* dependencies
|
|
45
|
+
* @twin.org/core bumped from 0.0.1-next.57 to 0.0.1-next.58
|
|
46
|
+
* @twin.org/crypto bumped from 0.0.1-next.57 to 0.0.1-next.58
|
|
47
|
+
|
|
48
|
+
## [0.0.1-next.57](https://github.com/twinfoundation/framework/compare/cli-core-v0.0.1-next.56...cli-core-v0.0.1-next.57) (2025-06-10)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
### Features
|
|
52
|
+
|
|
53
|
+
* add guards arrayEndsWith and arrayStartsWith ([95d875e](https://github.com/twinfoundation/framework/commit/95d875ec8ccb4713c145fdde941d4cfedcec2ed3))
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
### Dependencies
|
|
57
|
+
|
|
58
|
+
* The following workspace dependencies were updated
|
|
59
|
+
* dependencies
|
|
60
|
+
* @twin.org/core bumped from 0.0.1-next.56 to 0.0.1-next.57
|
|
61
|
+
* @twin.org/crypto bumped from 0.0.1-next.56 to 0.0.1-next.57
|
|
62
|
+
|
|
63
|
+
## [0.0.1-next.56](https://github.com/twinfoundation/framework/compare/cli-core-v0.0.1-next.55...cli-core-v0.0.1-next.56) (2025-05-08)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
### Miscellaneous Chores
|
|
67
|
+
|
|
68
|
+
* **cli-core:** Synchronize repo versions
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
### Dependencies
|
|
72
|
+
|
|
73
|
+
* The following workspace dependencies were updated
|
|
74
|
+
* dependencies
|
|
75
|
+
* @twin.org/core bumped from 0.0.1-next.55 to 0.0.1-next.56
|
|
76
|
+
* @twin.org/crypto bumped from 0.0.1-next.55 to 0.0.1-next.56
|
|
77
|
+
|
|
78
|
+
## [0.0.1-next.55](https://github.com/twinfoundation/framework/compare/cli-core-v0.0.1-next.54...cli-core-v0.0.1-next.55) (2025-05-07)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
### Miscellaneous Chores
|
|
82
|
+
|
|
83
|
+
* **cli-core:** Synchronize repo versions
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
### Dependencies
|
|
87
|
+
|
|
88
|
+
* The following workspace dependencies were updated
|
|
89
|
+
* dependencies
|
|
90
|
+
* @twin.org/core bumped from 0.0.1-next.54 to 0.0.1-next.55
|
|
91
|
+
* @twin.org/crypto bumped from 0.0.1-next.54 to 0.0.1-next.55
|
|
92
|
+
|
|
93
|
+
## [0.0.1-next.54](https://github.com/twinfoundation/framework/compare/cli-core-v0.0.1-next.53...cli-core-v0.0.1-next.54) (2025-05-06)
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
### Miscellaneous Chores
|
|
97
|
+
|
|
98
|
+
* **cli-core:** Synchronize repo versions
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
### Dependencies
|
|
102
|
+
|
|
103
|
+
* The following workspace dependencies were updated
|
|
104
|
+
* dependencies
|
|
105
|
+
* @twin.org/core bumped from 0.0.1-next.53 to 0.0.1-next.54
|
|
106
|
+
* @twin.org/crypto bumped from 0.0.1-next.53 to 0.0.1-next.54
|
|
107
|
+
|
|
108
|
+
## [0.0.1-next.53](https://github.com/twinfoundation/framework/compare/cli-core-v0.0.1-next.52...cli-core-v0.0.1-next.53) (2025-05-01)
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
### Miscellaneous Chores
|
|
112
|
+
|
|
113
|
+
* **cli-core:** Synchronize repo versions
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
### Dependencies
|
|
117
|
+
|
|
118
|
+
* The following workspace dependencies were updated
|
|
119
|
+
* dependencies
|
|
120
|
+
* @twin.org/core bumped from 0.0.1-next.52 to 0.0.1-next.53
|
|
121
|
+
* @twin.org/crypto bumped from 0.0.1-next.52 to 0.0.1-next.53
|
|
122
|
+
|
|
123
|
+
## [0.0.1-next.52](https://github.com/twinfoundation/framework/compare/cli-core-v0.0.1-next.51...cli-core-v0.0.1-next.52) (2025-04-17)
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
### Features
|
|
127
|
+
|
|
128
|
+
* use new shared store mechanism ([#131](https://github.com/twinfoundation/framework/issues/131)) ([934385b](https://github.com/twinfoundation/framework/commit/934385b2fbaf9f5c00a505ebf9d093bd5a425f55))
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
### Dependencies
|
|
132
|
+
|
|
133
|
+
* The following workspace dependencies were updated
|
|
134
|
+
* dependencies
|
|
135
|
+
* @twin.org/core bumped from 0.0.1-next.51 to 0.0.1-next.52
|
|
136
|
+
* @twin.org/crypto bumped from 0.0.1-next.51 to 0.0.1-next.52
|
|
137
|
+
|
|
138
|
+
## [0.0.1-next.51](https://github.com/twinfoundation/framework/compare/cli-core-v0.0.1-next.50...cli-core-v0.0.1-next.51) (2025-03-27)
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
### Miscellaneous Chores
|
|
142
|
+
|
|
143
|
+
* **cli-core:** Synchronize repo versions
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
### Dependencies
|
|
147
|
+
|
|
148
|
+
* The following workspace dependencies were updated
|
|
149
|
+
* dependencies
|
|
150
|
+
* @twin.org/core bumped from 0.0.1-next.50 to 0.0.1-next.51
|
|
151
|
+
* @twin.org/crypto bumped from 0.0.1-next.50 to 0.0.1-next.51
|
|
152
|
+
|
|
153
|
+
## [0.0.1-next.50](https://github.com/twinfoundation/framework/compare/cli-core-v0.0.1-next.49...cli-core-v0.0.1-next.50) (2025-03-26)
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
### Miscellaneous Chores
|
|
157
|
+
|
|
158
|
+
* **cli-core:** Synchronize repo versions
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
### Dependencies
|
|
162
|
+
|
|
163
|
+
* The following workspace dependencies were updated
|
|
164
|
+
* dependencies
|
|
165
|
+
* @twin.org/core bumped from 0.0.1-next.49 to 0.0.1-next.50
|
|
166
|
+
* @twin.org/crypto bumped from 0.0.1-next.49 to 0.0.1-next.50
|
|
167
|
+
|
|
168
|
+
## 0.0.1-next.49
|
|
4
169
|
|
|
5
170
|
- Initial Release
|
|
@@ -4,13 +4,13 @@ The main entry point for the CLI.
|
|
|
4
4
|
|
|
5
5
|
## Constructors
|
|
6
6
|
|
|
7
|
-
###
|
|
7
|
+
### Constructor
|
|
8
8
|
|
|
9
|
-
> **new CLIBase**():
|
|
9
|
+
> **new CLIBase**(): `CLIBase`
|
|
10
10
|
|
|
11
11
|
#### Returns
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
`CLIBase`
|
|
14
14
|
|
|
15
15
|
## Methods
|
|
16
16
|
|
|
@@ -22,15 +22,21 @@ Execute the command line processing.
|
|
|
22
22
|
|
|
23
23
|
#### Parameters
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
##### options
|
|
26
|
+
|
|
27
|
+
[`ICliOptions`](../interfaces/ICliOptions.md)
|
|
26
28
|
|
|
27
29
|
The options for the CLI.
|
|
28
30
|
|
|
29
|
-
|
|
31
|
+
##### localesDirectory
|
|
32
|
+
|
|
33
|
+
`string`
|
|
30
34
|
|
|
31
35
|
The path to load the locales from.
|
|
32
36
|
|
|
33
|
-
|
|
37
|
+
##### argv
|
|
38
|
+
|
|
39
|
+
`string`[]
|
|
34
40
|
|
|
35
41
|
The process arguments.
|
|
36
42
|
|
|
@@ -50,7 +56,9 @@ Configure any options or actions at the root program level.
|
|
|
50
56
|
|
|
51
57
|
#### Parameters
|
|
52
58
|
|
|
53
|
-
|
|
59
|
+
##### program
|
|
60
|
+
|
|
61
|
+
`Command`
|
|
54
62
|
|
|
55
63
|
The root program command.
|
|
56
64
|
|
|
@@ -68,7 +76,9 @@ Get the commands for the CLI, override in derived class to supply your own.
|
|
|
68
76
|
|
|
69
77
|
#### Parameters
|
|
70
78
|
|
|
71
|
-
|
|
79
|
+
##### program
|
|
80
|
+
|
|
81
|
+
`Command`
|
|
72
82
|
|
|
73
83
|
The main program that the commands will be added to.
|
|
74
84
|
|
|
@@ -4,13 +4,13 @@ Display utilities for the CLI.
|
|
|
4
4
|
|
|
5
5
|
## Constructors
|
|
6
6
|
|
|
7
|
-
###
|
|
7
|
+
### Constructor
|
|
8
8
|
|
|
9
|
-
> **new CLIDisplay**():
|
|
9
|
+
> **new CLIDisplay**(): `CLIDisplay`
|
|
10
10
|
|
|
11
11
|
#### Returns
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
`CLIDisplay`
|
|
14
14
|
|
|
15
15
|
## Properties
|
|
16
16
|
|
|
@@ -22,10 +22,12 @@ The default output method for writing standard messages.
|
|
|
22
22
|
|
|
23
23
|
#### Parameters
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
##### buffer
|
|
26
26
|
|
|
27
27
|
The message to output.
|
|
28
28
|
|
|
29
|
+
`string` | `Uint8Array`\<`ArrayBufferLike`\>
|
|
30
|
+
|
|
29
31
|
#### Returns
|
|
30
32
|
|
|
31
33
|
`void`
|
|
@@ -40,10 +42,12 @@ The default output method for writing error messages.
|
|
|
40
42
|
|
|
41
43
|
#### Parameters
|
|
42
44
|
|
|
43
|
-
|
|
45
|
+
##### buffer
|
|
44
46
|
|
|
45
47
|
The message to output.
|
|
46
48
|
|
|
49
|
+
`string` | `Uint8Array`\<`ArrayBufferLike`\>
|
|
50
|
+
|
|
47
51
|
#### Returns
|
|
48
52
|
|
|
49
53
|
`void`
|
|
@@ -70,15 +74,21 @@ Display the header for the CLI.
|
|
|
70
74
|
|
|
71
75
|
#### Parameters
|
|
72
76
|
|
|
73
|
-
|
|
77
|
+
##### title
|
|
78
|
+
|
|
79
|
+
`string`
|
|
74
80
|
|
|
75
81
|
The title of the CLI.
|
|
76
82
|
|
|
77
|
-
|
|
83
|
+
##### version
|
|
84
|
+
|
|
85
|
+
`string`
|
|
78
86
|
|
|
79
87
|
The version of the CLI.
|
|
80
88
|
|
|
81
|
-
|
|
89
|
+
##### icon
|
|
90
|
+
|
|
91
|
+
`string`
|
|
82
92
|
|
|
83
93
|
The icon for the CLI.
|
|
84
94
|
|
|
@@ -96,11 +106,15 @@ Display an error message.
|
|
|
96
106
|
|
|
97
107
|
#### Parameters
|
|
98
108
|
|
|
99
|
-
|
|
109
|
+
##### error
|
|
110
|
+
|
|
111
|
+
`unknown`
|
|
100
112
|
|
|
101
113
|
The error to display.
|
|
102
114
|
|
|
103
|
-
|
|
115
|
+
##### lineBreaks
|
|
116
|
+
|
|
117
|
+
`boolean` = `true`
|
|
104
118
|
|
|
105
119
|
Whether to add a line break after the error.
|
|
106
120
|
|
|
@@ -118,7 +132,9 @@ Display a section.
|
|
|
118
132
|
|
|
119
133
|
#### Parameters
|
|
120
134
|
|
|
121
|
-
|
|
135
|
+
##### label
|
|
136
|
+
|
|
137
|
+
`string`
|
|
122
138
|
|
|
123
139
|
The label for the section.
|
|
124
140
|
|
|
@@ -136,15 +152,21 @@ Display a value with a label.
|
|
|
136
152
|
|
|
137
153
|
#### Parameters
|
|
138
154
|
|
|
139
|
-
|
|
155
|
+
##### label
|
|
156
|
+
|
|
157
|
+
`string`
|
|
140
158
|
|
|
141
159
|
The label for the value.
|
|
142
160
|
|
|
143
|
-
|
|
161
|
+
##### value
|
|
162
|
+
|
|
163
|
+
`unknown`
|
|
144
164
|
|
|
145
165
|
The value to display.
|
|
146
166
|
|
|
147
|
-
|
|
167
|
+
##### indentLevel
|
|
168
|
+
|
|
169
|
+
`number` = `0`
|
|
148
170
|
|
|
149
171
|
The level of indentation.
|
|
150
172
|
|
|
@@ -156,17 +178,21 @@ The level of indentation.
|
|
|
156
178
|
|
|
157
179
|
### task()
|
|
158
180
|
|
|
159
|
-
> `static` **task**(`label`, `task
|
|
181
|
+
> `static` **task**(`label`, `task?`): `void`
|
|
160
182
|
|
|
161
183
|
Display a task with a label.
|
|
162
184
|
|
|
163
185
|
#### Parameters
|
|
164
186
|
|
|
165
|
-
|
|
187
|
+
##### label
|
|
188
|
+
|
|
189
|
+
`string`
|
|
166
190
|
|
|
167
191
|
The label for the value.
|
|
168
192
|
|
|
169
|
-
|
|
193
|
+
##### task?
|
|
194
|
+
|
|
195
|
+
`string`
|
|
170
196
|
|
|
171
197
|
The task to display.
|
|
172
198
|
|
|
@@ -196,7 +222,9 @@ Display formatted and colorized JSON.
|
|
|
196
222
|
|
|
197
223
|
#### Parameters
|
|
198
224
|
|
|
199
|
-
|
|
225
|
+
##### obj
|
|
226
|
+
|
|
227
|
+
`unknown`
|
|
200
228
|
|
|
201
229
|
The object to display.
|
|
202
230
|
|
|
@@ -226,15 +254,21 @@ Start the spinner.
|
|
|
226
254
|
|
|
227
255
|
#### Parameters
|
|
228
256
|
|
|
229
|
-
|
|
257
|
+
##### i18nMessage
|
|
258
|
+
|
|
259
|
+
`string` = `"cli.progress.pleaseWait"`
|
|
230
260
|
|
|
231
261
|
The message to display with the spinner.
|
|
232
262
|
|
|
233
|
-
|
|
263
|
+
##### spinnerCharacters
|
|
264
|
+
|
|
265
|
+
`string`[] = `...`
|
|
234
266
|
|
|
235
267
|
The characters to use in the spinner.
|
|
236
268
|
|
|
237
|
-
|
|
269
|
+
##### interval
|
|
270
|
+
|
|
271
|
+
`number` = `100`
|
|
238
272
|
|
|
239
273
|
The interval for the spinner.
|
|
240
274
|
|
|
@@ -4,13 +4,13 @@ Utilities for getting standard options.
|
|
|
4
4
|
|
|
5
5
|
## Constructors
|
|
6
6
|
|
|
7
|
-
###
|
|
7
|
+
### Constructor
|
|
8
8
|
|
|
9
|
-
> **new CLIOptions**():
|
|
9
|
+
> **new CLIOptions**(): `CLIOptions`
|
|
10
10
|
|
|
11
11
|
#### Returns
|
|
12
12
|
|
|
13
|
-
|
|
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
|
-
|
|
25
|
+
##### command
|
|
26
|
+
|
|
27
|
+
`Command`
|
|
26
28
|
|
|
27
29
|
The command to add the options to.
|
|
28
30
|
|
|
29
|
-
|
|
31
|
+
##### opts
|
|
30
32
|
|
|
31
33
|
The options of what to include.
|
|
32
34
|
|
|
33
|
-
|
|
35
|
+
###### noConsole
|
|
36
|
+
|
|
37
|
+
`boolean`
|
|
34
38
|
|
|
35
39
|
Do not output to the console.
|
|
36
40
|
|
|
37
|
-
|
|
41
|
+
###### json
|
|
42
|
+
|
|
43
|
+
`boolean`
|
|
38
44
|
|
|
39
45
|
Output to a JSON file.
|
|
40
46
|
|
|
41
|
-
|
|
47
|
+
###### env
|
|
48
|
+
|
|
49
|
+
`boolean`
|
|
42
50
|
|
|
43
51
|
Output to an environment file.
|
|
44
52
|
|
|
45
|
-
|
|
53
|
+
###### mergeJson
|
|
54
|
+
|
|
55
|
+
`boolean`
|
|
46
56
|
|
|
47
57
|
Merge existing JSON file.
|
|
48
58
|
|
|
49
|
-
|
|
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
|
-
###
|
|
7
|
+
### Constructor
|
|
8
8
|
|
|
9
|
-
> **new CLIParam**():
|
|
9
|
+
> **new CLIParam**(): `CLIParam`
|
|
10
10
|
|
|
11
11
|
#### Returns
|
|
12
12
|
|
|
13
|
-
|
|
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
|
-
|
|
25
|
+
##### optionName
|
|
26
|
+
|
|
27
|
+
`string`
|
|
26
28
|
|
|
27
29
|
The name of the option.
|
|
28
30
|
|
|
29
|
-
|
|
31
|
+
##### optionValue
|
|
30
32
|
|
|
31
33
|
The option value.
|
|
32
34
|
|
|
33
|
-
|
|
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
|
|
59
|
+
Check the option to see if the String exists.
|
|
54
60
|
|
|
55
61
|
#### Parameters
|
|
56
62
|
|
|
57
|
-
|
|
63
|
+
##### optionName
|
|
64
|
+
|
|
65
|
+
`string`
|
|
58
66
|
|
|
59
67
|
The name of the option.
|
|
60
68
|
|
|
61
|
-
|
|
69
|
+
##### optionValue
|
|
62
70
|
|
|
63
71
|
The option value.
|
|
64
72
|
|
|
65
|
-
|
|
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
|
-
|
|
101
|
+
##### optionName
|
|
102
|
+
|
|
103
|
+
`string`
|
|
90
104
|
|
|
91
105
|
The name of the option.
|
|
92
106
|
|
|
93
|
-
|
|
107
|
+
##### optionValue
|
|
94
108
|
|
|
95
109
|
The option value.
|
|
96
110
|
|
|
97
|
-
|
|
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
|
|
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
|
-
|
|
139
|
+
##### optionName
|
|
140
|
+
|
|
141
|
+
`string`
|
|
122
142
|
|
|
123
143
|
The name of the option.
|
|
124
144
|
|
|
125
|
-
|
|
145
|
+
##### optionValue
|
|
126
146
|
|
|
127
147
|
The option value.
|
|
128
148
|
|
|
129
|
-
|
|
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
|
-
|
|
157
|
+
##### minValue
|
|
158
|
+
|
|
159
|
+
`number` = `0`
|
|
134
160
|
|
|
135
161
|
The minimum value.
|
|
136
162
|
|
|
137
|
-
|
|
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
|
|
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
|
-
|
|
189
|
+
##### optionName
|
|
190
|
+
|
|
191
|
+
`string`
|
|
162
192
|
|
|
163
193
|
The name of the option.
|
|
164
194
|
|
|
165
|
-
|
|
195
|
+
##### optionValue
|
|
166
196
|
|
|
167
197
|
The option value.
|
|
168
198
|
|
|
169
|
-
|
|
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
|
-
|
|
207
|
+
##### minValue
|
|
208
|
+
|
|
209
|
+
`number` = `0`
|
|
174
210
|
|
|
175
211
|
The minimum value.
|
|
176
212
|
|
|
177
|
-
|
|
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
|
|
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
|
-
|
|
239
|
+
##### optionName
|
|
240
|
+
|
|
241
|
+
`string`
|
|
202
242
|
|
|
203
243
|
The name of the option.
|
|
204
244
|
|
|
205
|
-
|
|
245
|
+
##### optionValue
|
|
206
246
|
|
|
207
247
|
The option value.
|
|
208
248
|
|
|
209
|
-
|
|
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
|
-
|
|
257
|
+
##### minValue
|
|
258
|
+
|
|
259
|
+
`bigint` = `0n`
|
|
214
260
|
|
|
215
261
|
The minimum value.
|
|
216
262
|
|
|
217
|
-
|
|
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
|
-
|
|
289
|
+
##### optionName
|
|
290
|
+
|
|
291
|
+
`string`
|
|
242
292
|
|
|
243
293
|
The name of the option.
|
|
244
294
|
|
|
245
|
-
|
|
295
|
+
##### optionValue
|
|
246
296
|
|
|
247
297
|
The option value.
|
|
248
298
|
|
|
249
|
-
|
|
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
|
-
|
|
327
|
+
##### optionName
|
|
328
|
+
|
|
329
|
+
`string`
|
|
274
330
|
|
|
275
331
|
The name of the option.
|
|
276
332
|
|
|
277
|
-
|
|
333
|
+
##### optionValue
|
|
278
334
|
|
|
279
335
|
The option value.
|
|
280
336
|
|
|
281
|
-
|
|
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
|
-
|
|
365
|
+
##### optionName
|
|
366
|
+
|
|
367
|
+
`string`
|
|
306
368
|
|
|
307
369
|
The name of the option.
|
|
308
370
|
|
|
309
|
-
|
|
371
|
+
##### optionValue
|
|
310
372
|
|
|
311
373
|
The option value.
|
|
312
374
|
|
|
313
|
-
|
|
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
|
-
|
|
403
|
+
##### optionName
|
|
404
|
+
|
|
405
|
+
`string`
|
|
338
406
|
|
|
339
407
|
The name of the option.
|
|
340
408
|
|
|
341
|
-
|
|
409
|
+
##### optionValue
|
|
342
410
|
|
|
343
411
|
The option value.
|
|
344
412
|
|
|
345
|
-
|
|
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
|
-
|
|
441
|
+
##### optionName
|
|
442
|
+
|
|
443
|
+
`string`
|
|
370
444
|
|
|
371
445
|
The name of the option.
|
|
372
446
|
|
|
373
|
-
|
|
447
|
+
##### optionValue
|
|
374
448
|
|
|
375
449
|
The option value.
|
|
376
450
|
|
|
377
|
-
|
|
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
|
-
###
|
|
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.1-next.
|
|
3
|
+
"version": "0.0.1-next.60",
|
|
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.1-next.
|
|
18
|
-
"@twin.org/crypto": "0.0.1-next.
|
|
17
|
+
"@twin.org/core": "0.0.1-next.60",
|
|
18
|
+
"@twin.org/crypto": "0.0.1-next.60",
|
|
19
19
|
"@twin.org/nameof": "next",
|
|
20
|
-
"chalk": "5.
|
|
21
|
-
"commander": "
|
|
22
|
-
"dotenv": "16.
|
|
20
|
+
"chalk": "5.4.1",
|
|
21
|
+
"commander": "14.0.0",
|
|
22
|
+
"dotenv": "16.5.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": [
|