@oclif/core 1.6.4 → 1.7.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 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.7.0](https://github.com/oclif/core/compare/v1.6.4...v1.7.0) (2022-04-11)
6
+
7
+
8
+ ### Features
9
+
10
+ * move console.log to single class method ([#400](https://github.com/oclif/core/issues/400)) ([2ccb274](https://github.com/oclif/core/commit/2ccb2740912dba3b81c4d36712fbb20fd6a03c23))
11
+
5
12
  ### [1.6.4](https://github.com/oclif/core/compare/v1.6.3...v1.6.4) (2022-03-31)
6
13
 
7
14
 
@@ -41,4 +41,5 @@ export declare class Help extends HelpBase {
41
41
  * @return {string} the readme help string for the given command
42
42
  */
43
43
  protected command(command: Interfaces.Command): string;
44
+ protected log(...args: string[]): void;
44
45
  }
package/lib/help/index.js CHANGED
@@ -118,20 +118,20 @@ class Help extends HelpBase {
118
118
  const plugin = this.config.plugins.find(p => p.name === command.pluginName);
119
119
  const state = ((_b = (_a = this.config.pjson) === null || _a === void 0 ? void 0 : _a.oclif) === null || _b === void 0 ? void 0 : _b.state) || ((_d = (_c = plugin === null || plugin === void 0 ? void 0 : plugin.pjson) === null || _c === void 0 ? void 0 : _c.oclif) === null || _d === void 0 ? void 0 : _d.state) || command.state;
120
120
  if (state)
121
- console.log(`This command is in ${state}.\n`);
121
+ this.log(`This command is in ${state}.\n`);
122
122
  const summary = this.summary(command);
123
123
  if (summary) {
124
- console.log(summary + '\n');
124
+ this.log(summary + '\n');
125
125
  }
126
- console.log(this.formatCommand(command));
127
- console.log('');
126
+ this.log(this.formatCommand(command));
127
+ this.log('');
128
128
  if (subTopics.length > 0) {
129
- console.log(this.formatTopics(subTopics));
130
- console.log('');
129
+ this.log(this.formatTopics(subTopics));
130
+ this.log('');
131
131
  }
132
132
  if (subCommands.length > 0) {
133
- console.log(this.formatCommands(subCommands));
134
- console.log('');
133
+ this.log(this.formatCommands(subCommands));
134
+ this.log('');
135
135
  }
136
136
  }
137
137
  async showRootHelp() {
@@ -140,21 +140,21 @@ class Help extends HelpBase {
140
140
  let rootCommands = this.sortedCommands;
141
141
  const state = (_b = (_a = this.config.pjson) === null || _a === void 0 ? void 0 : _a.oclif) === null || _b === void 0 ? void 0 : _b.state;
142
142
  if (state)
143
- console.log(`${this.config.bin} is in ${state}.\n`);
144
- console.log(this.formatRoot());
145
- console.log('');
143
+ this.log(`${this.config.bin} is in ${state}.\n`);
144
+ this.log(this.formatRoot());
145
+ this.log('');
146
146
  if (!this.opts.all) {
147
147
  rootTopics = rootTopics.filter(t => !t.name.includes(':'));
148
148
  rootCommands = rootCommands.filter(c => !c.id.includes(':'));
149
149
  }
150
150
  if (rootTopics.length > 0) {
151
- console.log(this.formatTopics(rootTopics));
152
- console.log('');
151
+ this.log(this.formatTopics(rootTopics));
152
+ this.log('');
153
153
  }
154
154
  if (rootCommands.length > 0) {
155
155
  rootCommands = rootCommands.filter(c => c.id);
156
- console.log(this.formatCommands(rootCommands));
157
- console.log('');
156
+ this.log(this.formatCommands(rootCommands));
157
+ this.log('');
158
158
  }
159
159
  }
160
160
  async showTopicHelp(topic) {
@@ -165,15 +165,15 @@ class Help extends HelpBase {
165
165
  const commands = this.sortedCommands.filter(c => c.id.startsWith(name + ':') && c.id.split(':').length === depth + 1);
166
166
  const state = (_b = (_a = this.config.pjson) === null || _a === void 0 ? void 0 : _a.oclif) === null || _b === void 0 ? void 0 : _b.state;
167
167
  if (state)
168
- console.log(`This topic is in ${state}.\n`);
169
- console.log(this.formatTopic(topic));
168
+ this.log(`This topic is in ${state}.\n`);
169
+ this.log(this.formatTopic(topic));
170
170
  if (subTopics.length > 0) {
171
- console.log(this.formatTopics(subTopics));
172
- console.log('');
171
+ this.log(this.formatTopics(subTopics));
172
+ this.log('');
173
173
  }
174
174
  if (commands.length > 0) {
175
- console.log(this.formatCommands(commands));
176
- console.log('');
175
+ this.log(this.formatCommands(commands));
176
+ this.log('');
177
177
  }
178
178
  }
179
179
  formatRoot() {
@@ -261,5 +261,8 @@ class Help extends HelpBase {
261
261
  command(command) {
262
262
  return this.formatCommand(command);
263
263
  }
264
+ log(...args) {
265
+ console.log(...args);
266
+ }
264
267
  }
265
268
  exports.Help = Help;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@oclif/core",
3
3
  "description": "base library for oclif CLIs",
4
- "version": "1.6.4",
4
+ "version": "1.7.0",
5
5
  "author": "Salesforce",
6
6
  "bugs": "https://github.com/oclif/core/issues",
7
7
  "dependencies": {