@salesforce/cli 1.66.1 → 1.67.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/dist/cli.js +1 -1
- package/dist/hooks/incomplete.js +19 -3
- package/npm-shrinkwrap.json +1657 -1996
- package/oclif.manifest.json +1 -1
- package/package.json +26 -23
package/dist/cli.js
CHANGED
|
@@ -113,7 +113,7 @@ function create(version, channel, run, env = env_1.default) {
|
|
|
113
113
|
debugCliInfo(version, channel, env, config);
|
|
114
114
|
if (args[0] === 'doctor') {
|
|
115
115
|
// The doctor command requires CLI version details obtained from the CLI's oclif config.
|
|
116
|
-
const versionDetail =
|
|
116
|
+
const versionDetail = await plugin_version_1.VersionCommand.run(['--verbose', '--json']);
|
|
117
117
|
plugin_info_1.Doctor.init(config, versionDetail);
|
|
118
118
|
}
|
|
119
119
|
// Example of how run is used in a test https://github.com/salesforcecli/cli/pull/171/files#diff-1deee0a575599b2df117c280da319f7938aaf6fdb0c04bcdbde769dbf464be69R46
|
package/dist/hooks/incomplete.js
CHANGED
|
@@ -10,24 +10,40 @@ const os = require("os");
|
|
|
10
10
|
const core_1 = require("@oclif/core");
|
|
11
11
|
const sf_plugins_core_1 = require("@salesforce/sf-plugins-core");
|
|
12
12
|
const core_2 = require("@salesforce/core");
|
|
13
|
+
function buildChoices(matches, config) {
|
|
14
|
+
const configuredIds = matches.map((p) => (0, core_1.toConfiguredId)(p.id, config));
|
|
15
|
+
const maxCommandLength = configuredIds.reduce((max, id) => Math.max(max, id.length), 0);
|
|
16
|
+
return matches.map((p, i) => {
|
|
17
|
+
const summary = p.summary ?? p.description?.split(os.EOL)[0] ?? '';
|
|
18
|
+
return {
|
|
19
|
+
name: `${configuredIds[i].padEnd(maxCommandLength + 5, ' ')}${summary}`,
|
|
20
|
+
value: p,
|
|
21
|
+
short: configuredIds[i],
|
|
22
|
+
};
|
|
23
|
+
});
|
|
24
|
+
}
|
|
13
25
|
async function determineCommand(config, matches) {
|
|
14
26
|
if (matches.length === 1)
|
|
15
27
|
return matches[0].id;
|
|
16
28
|
const prompter = new sf_plugins_core_1.Prompter();
|
|
29
|
+
const choices = buildChoices(matches, config);
|
|
17
30
|
const { command } = await prompter.timedPrompt([
|
|
18
31
|
{
|
|
19
32
|
name: 'command',
|
|
20
33
|
type: 'list',
|
|
21
34
|
message: 'Which of these commands do you mean',
|
|
22
|
-
choices
|
|
35
|
+
choices,
|
|
23
36
|
},
|
|
24
37
|
]);
|
|
25
|
-
return command;
|
|
38
|
+
return command.id;
|
|
26
39
|
}
|
|
27
40
|
const hook = async function ({ config, matches, argv }) {
|
|
28
41
|
const command = await determineCommand(config, matches);
|
|
29
42
|
if (argv.includes('--help') || argv.includes('-h')) {
|
|
30
|
-
|
|
43
|
+
const Help = await (0, core_1.loadHelpClass)(config);
|
|
44
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
45
|
+
const help = new Help(config, config.pjson.helpOptions);
|
|
46
|
+
return help.showHelp([(0, core_1.toStandardizedId)(command, config), ...argv]);
|
|
31
47
|
}
|
|
32
48
|
if (matches.length === 1) {
|
|
33
49
|
await core_2.Lifecycle.getInstance().emitWarning(`One command matches the partial command entered, running command:${os.EOL}${config.bin} ${(0, core_1.toConfiguredId)(command, config)} ${argv.join(' ')}`);
|