Skip to content

Conversation

@santysisi
Copy link
Contributor

Q A
Branch? 6.4
Bug fix? yes
New feature? no
Deprecations? no
Issues Fix #62618
License MIT

This PR resolves 3 issues:

  1. The first one is the commented in the issue. The --help is not preserved when a command is not found
  2. The second issue this pull request resolves is that hidden commands are currently being displayed if the --help option is present and the original command is not found.
  3. The final issue this pull request resolves is that the "Did you mean?" prompt is not displayed if no alternative command is present.

@santysisi santysisi requested a review from chalasr as a code owner December 2, 2025 23:21
@carsonbot carsonbot added this to the 6.4 milestone Dec 2, 2025
@santysisi santysisi force-pushed the fix/preserve-help-option-when-a-command-is-not-found branch from 632e02c to 8696efc Compare December 2, 2025 23:35
@Maxcastel
Copy link

In a shorter way:

if ($this->wantHelps) {
    $this->wantHelps = false;

    $helpCommand = $this->get('help');
    $helpCommand->setCommand($command);

+    $this->wantHelps = true;

    return $helpCommand;
}

@Maxcastel
Copy link

You added tests, but even without changing Application.php, the tests pass, and I think they shouldn’t pass.

@santysisi santysisi force-pushed the fix/preserve-help-option-when-a-command-is-not-found branch 2 times, most recently from 7dcead4 to 985b75e Compare December 3, 2025 01:53
@santysisi
Copy link
Contributor Author

santysisi commented Dec 3, 2025

Hi @Maxcastel, thank you so much for your feedback 😄

You added tests, but even without changing Application.php, the tests pass, and I think they shouldn’t pass.

You're right, the testDoesNotFindHiddenCommandAsAlternativeIfHelpOptionIsPresent test pass correctly without the new changes (my fault). The other tests didn't work correctly without the changes in my local. Could you give me an example of the problem, please, so I can try to fix it? 😄

In a shorter way:

I'm not sure about that change 🤔

@santysisi
Copy link
Contributor Author

the testDoesNotFindHiddenCommandAsAlternativeIfHelpOptionIsPresent test pass correctly without the new changes (my fault)

I modified the test testDoesNotFindHiddenCommandAsAlternativeIfHelpOptionIsPresent for tests correctly the new behavior

Thanks again for your feedback :)

@Maxcastel
Copy link

Maxcastel commented Dec 3, 2025

I didn’t run the right tests 😅 Sorry @santysisi for the inconvenience.

@santysisi santysisi force-pushed the fix/preserve-help-option-when-a-command-is-not-found branch from 985b75e to e240a69 Compare December 5, 2025 01:27
@nicolas-grekas nicolas-grekas force-pushed the fix/preserve-help-option-when-a-command-is-not-found branch from e240a69 to ac79f5b Compare December 5, 2025 07:19
@nicolas-grekas
Copy link
Member

Thank you @santysisi.

@nicolas-grekas nicolas-grekas merged commit f39e9b9 into symfony:6.4 Dec 5, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants