@oclif/core 1.9.10 → 1.10.0
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/CHANGELOG.md +7 -0
- package/lib/command.d.ts +1 -0
- package/lib/command.js +6 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [1.10.0](https://github.com/oclif/core/compare/v1.9.10...v1.10.0) (2022-07-15)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* add stderr method ([#441](https://github.com/oclif/core/issues/441)) ([d9490f7](https://github.com/oclif/core/commit/d9490f77ff4cac0ee9767f1386f18c7357e0666e))
|
|
11
|
+
|
|
5
12
|
### [1.9.10](https://github.com/oclif/core/compare/v1.9.9...v1.9.10) (2022-07-15)
|
|
6
13
|
|
|
7
14
|
### [1.9.9](https://github.com/oclif/core/compare/v1.9.8...v1.9.9) (2022-07-14)
|
package/lib/command.d.ts
CHANGED
|
@@ -86,6 +86,7 @@ export default abstract class Command {
|
|
|
86
86
|
exit?: number;
|
|
87
87
|
} & PrettyPrintableError): never;
|
|
88
88
|
log(message?: string, ...args: any[]): void;
|
|
89
|
+
logToStderr(message?: string, ...args: any[]): void;
|
|
89
90
|
jsonEnabled(): boolean;
|
|
90
91
|
/**
|
|
91
92
|
* actual command run code goes here
|
package/lib/command.js
CHANGED
|
@@ -91,11 +91,16 @@ class Command {
|
|
|
91
91
|
}
|
|
92
92
|
log(message = '', ...args) {
|
|
93
93
|
if (!this.jsonEnabled()) {
|
|
94
|
-
// tslint:disable-next-line strict-type-predicates
|
|
95
94
|
message = typeof message === 'string' ? message : (0, util_1.inspect)(message);
|
|
96
95
|
process.stdout.write((0, util_1.format)(message, ...args) + '\n');
|
|
97
96
|
}
|
|
98
97
|
}
|
|
98
|
+
logToStderr(message = '', ...args) {
|
|
99
|
+
if (!this.jsonEnabled()) {
|
|
100
|
+
message = typeof message === 'string' ? message : (0, util_1.inspect)(message);
|
|
101
|
+
process.stderr.write((0, util_1.format)(message, ...args) + '\n');
|
|
102
|
+
}
|
|
103
|
+
}
|
|
99
104
|
jsonEnabled() {
|
|
100
105
|
return this.ctor.enableJsonFlag && this.argv.includes('--json');
|
|
101
106
|
}
|