@salesforce/cli 2.24.1 → 2.24.3

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.
@@ -6,7 +6,6 @@
6
6
  */
7
7
  import * as os from 'node:os';
8
8
  import { toConfiguredId, toStandardizedId, loadHelpClass } from '@oclif/core';
9
- import { Prompter } from '@salesforce/sf-plugins-core';
10
9
  function buildChoices(matches, config) {
11
10
  const configuredIds = matches.map((p) => toConfiguredId(p.id, config));
12
11
  const maxCommandLength = configuredIds.reduce((max, id) => Math.max(max, id.length), 0);
@@ -14,23 +13,27 @@ function buildChoices(matches, config) {
14
13
  const summary = p.summary ?? p.description?.split(os.EOL)[0] ?? '';
15
14
  return {
16
15
  name: `${configuredIds[i].padEnd(maxCommandLength + 5, ' ')}${summary}`,
17
- value: p,
16
+ value: p.id,
18
17
  short: configuredIds[i],
19
18
  };
20
19
  });
21
20
  }
22
21
  async function determineCommand(config, matches) {
23
- const prompter = new Prompter();
24
- const choices = buildChoices(matches, config);
25
- const { command } = await prompter.timedPrompt([
26
- {
27
- name: 'command',
28
- type: 'list',
29
- message: 'Which of these commands do you mean',
30
- choices,
31
- },
22
+ const [{ setTimeout }, { SfError }, select] = await Promise.all([
23
+ import('node:timers/promises'),
24
+ import('@salesforce/core'),
25
+ import('@inquirer/select'),
32
26
  ]);
33
- return command.id;
27
+ const choices = buildChoices(matches, config);
28
+ const answer = select.default({
29
+ message: 'Which of these commands do you mean',
30
+ choices,
31
+ });
32
+ const timeout = setTimeout(60000, undefined, { ref: false }).then(() => {
33
+ answer.cancel();
34
+ throw new SfError('Prompt timed out.');
35
+ });
36
+ return Promise.race([answer, timeout]);
34
37
  }
35
38
  const hook = async function ({ config, matches, argv }) {
36
39
  const command = await determineCommand(config, matches.filter((m) => !m.hidden));