@salesforce/cli 2.28.4 → 2.28.5

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 CHANGED
@@ -24,7 +24,7 @@ $ npm install -g @salesforce/cli
24
24
  $ sf COMMAND
25
25
  running command...
26
26
  $ sf (--version|-v)
27
- @salesforce/cli/2.28.4 linux-x64 node-v20.11.0
27
+ @salesforce/cli/2.28.5 linux-x64 node-v20.11.0
28
28
  $ sf --help [COMMAND]
29
29
  USAGE
30
30
  $ sf COMMAND
@@ -7310,7 +7310,7 @@ EXAMPLES
7310
7310
  $ sf update --available
7311
7311
  ```
7312
7312
 
7313
- _See code: [@oclif/plugin-update](https://github.com/oclif/plugin-update/blob/4.1.9/src/commands/update.ts)_
7313
+ _See code: [@oclif/plugin-update](https://github.com/oclif/plugin-update/blob/4.1.10/src/commands/update.ts)_
7314
7314
 
7315
7315
  ## `sf version`
7316
7316
 
@@ -4,7 +4,8 @@
4
4
  * Licensed under the BSD 3-Clause license.
5
5
  * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
6
  */
7
- import { Help } from '@oclif/core';
7
+ import { Help, toConfiguredId } from '@oclif/core';
8
+ import stripAnsi from 'strip-ansi';
8
9
  import chalk from 'chalk';
9
10
  import { SfCommandHelp } from './sfCommandHelp.js';
10
11
  export default class SfHelp extends Help {
@@ -13,16 +14,10 @@ export default class SfHelp extends Help {
13
14
  this.CommandHelpClass = SfCommandHelp;
14
15
  this.showShortHelp = false;
15
16
  this.commands = [];
16
- this.subCommands = {};
17
17
  }
18
18
  async showHelp(argv) {
19
19
  this.showShortHelp = argv.includes('-h');
20
- this.commands = this.config.commandIDs.map((c) => `${this.config.bin} ${c.replace(/:/g, this.config.topicSeparator)}`);
21
- for (const cmd of this.commands) {
22
- this.subCommands[cmd] = this.commands
23
- .filter((c) => c.startsWith(cmd) && c !== cmd)
24
- .map((c) => `${c.replace(cmd, '')}`);
25
- }
20
+ this.commands = this.config.commandIDs.map((c) => `${this.config.bin} ${toConfiguredId(c, this.config)}`);
26
21
  return super.showHelp(argv);
27
22
  }
28
23
  getCommandHelpClass(command) {
@@ -33,10 +28,21 @@ export default class SfHelp extends Help {
33
28
  log(...args) {
34
29
  const formatted = args.map((arg) => {
35
30
  for (const cmd of this.commands) {
36
- const regex = this.subCommands[cmd].length > 0
37
- ? new RegExp(`(?<!\\$ )${cmd}(?!${this.subCommands[cmd].join('|')})`, 'g')
38
- : new RegExp(`(?<!\\$ )${cmd}`, 'g');
39
- arg = arg.replace(regex, chalk.dim(cmd));
31
+ /**
32
+ * This regex matches any command in the help output.
33
+ * It will continue to match until the next space, quote, or period.
34
+ *
35
+ * Examples that will match:
36
+ * - sf deploy project start
37
+ * - "sf deploy project start"
38
+ * - sf org create scratch|sandbox
39
+ * - "sf org create scratch|sandbox"
40
+ */
41
+ const regex = new RegExp(`${cmd}([^\\s".]+)?`, 'g');
42
+ const [match] = stripAnsi(arg.slice()).match(regex) ?? [];
43
+ if (match) {
44
+ arg = arg.replace(regex, chalk.dim(match));
45
+ }
40
46
  }
41
47
  return arg;
42
48
  });