diff options
| author | Harold Mciver <[email protected]> | 2025-07-18 00:55:29 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-07-18 04:55:29 +0000 |
| commit | de27ea6095f3f36f8939af0aaeaf9362e3c61490 (patch) | |
| tree | 826a9461b8771d52c78da532e5c1471529a0fb46 /packages/cli/src/ui/components/InputPrompt.tsx | |
| parent | 8497176168dded563d4cb98ecc988ea79251758a (diff) | |
feat(cli): allow executing commands on perfect match (#4397)
Co-authored-by: Jenna Inouye <[email protected]>
Diffstat (limited to 'packages/cli/src/ui/components/InputPrompt.tsx')
| -rw-r--r-- | packages/cli/src/ui/components/InputPrompt.tsx | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/packages/cli/src/ui/components/InputPrompt.tsx b/packages/cli/src/ui/components/InputPrompt.tsx index 01ed8db1..4d66b10c 100644 --- a/packages/cli/src/ui/components/InputPrompt.tsx +++ b/packages/cli/src/ui/components/InputPrompt.tsx @@ -162,7 +162,7 @@ export const InputPrompt: React.FC<InputPromptProps> = ({ // - Otherwise, the base is everything EXCEPT the last partial part. const basePath = hasTrailingSpace || isParentPath ? parts : parts.slice(0, -1); - const newValue = `/${[...basePath, suggestion].join(' ')} `; + const newValue = `/${[...basePath, suggestion].join(' ')}`; buffer.setText(newValue); } else { @@ -266,6 +266,12 @@ export const InputPrompt: React.FC<InputPromptProps> = ({ return; } + // If the command is a perfect match, pressing enter should execute it. + if (completion.isPerfectMatch && key.name === 'return') { + handleSubmitAndClear(buffer.text); + return; + } + if (completion.showSuggestions) { if (completion.suggestions.length > 1) { if (key.name === 'up') { |
