Skip to content

Commit

Permalink
Merge pull request #1180 from salesforcecli/mdonnalley/prompt-single-…
Browse files Browse the repository at this point in the history
…matches

feat: prompt when single partial command match
  • Loading branch information
mshanemc authored Sep 28, 2023
2 parents 1bead0b + 85081d4 commit fb0c960
Showing 1 changed file with 0 additions and 11 deletions.
11 changes: 0 additions & 11 deletions src/hooks/incomplete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import * as os from 'os';
import { Hook, toConfiguredId, toStandardizedId, Interfaces, Command, loadHelpClass } from '@oclif/core';
import { Prompter } from '@salesforce/sf-plugins-core';
import { Lifecycle } from '@salesforce/core';

function buildChoices(
matches: Command.Loadable[],
Expand All @@ -27,7 +26,6 @@ function buildChoices(
}

async function determineCommand(config: Interfaces.Config, matches: Command.Loadable[]): Promise<string> {
if (matches.length === 1) return matches[0].id;
const prompter = new Prompter();
const choices = buildChoices(matches, config);
const { command } = await prompter.timedPrompt<{ command: Command.Loadable }>([
Expand All @@ -52,15 +50,6 @@ const hook: Hook.CommandIncomplete = async function ({ config, matches, argv })
return help.showHelp([toStandardizedId(command, config), ...argv]);
}

if (matches.length === 1) {
await Lifecycle.getInstance().emitWarning(
`One command matches the partial command entered, running command:${os.EOL}${config.bin} ${toConfiguredId(
command,
config
)} ${argv.join(' ')}`
);
}

return config.runCommand(toStandardizedId(command, config), argv);
};

Expand Down

0 comments on commit fb0c960

Please sign in to comment.