Skip to content

Commit

Permalink
feat: prompt when single partial command match
Browse files Browse the repository at this point in the history
  • Loading branch information
mdonnalley committed Sep 27, 2023
1 parent 6872c0a commit cd13d39
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 cd13d39

Please sign in to comment.