-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Console] Fix backslash escaping in bash completion #43665
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This comment has been minimized.
This comment has been minimized.
sorry, I've hidden my comment. The PR changed a lot from what I looked at yesterday night. I'll have to look again before sharing my opinion |
I'm rewriting this solution to use more native bash and less PHP. Mainly to remove dependency of the input in BashOutput. |
@wouterj I'm done with something more bash-native. The only limitation is with some values that are not unescaped: the token It would be awesome if we find a way to add tests to the bash script (unit or functional). |
4befcb8
to
b914980
Compare
I agree with that, but I have no idea how. |
Hi! I just tested it and I think this is perfect now you support both ways! I have 2 suggestions after quickly testing this:
|
@GromNaN Do you have time to have a look at Wouter's comments? I'd love to be able to merge this one to unlock some other PRs. Thank you. |
Imho, we can also merge this one and fix both of them between beta1 and rc1. The feature is complete - it's just some minor polishing. |
I'm going to make the requested changes tonight. |
By default, completion of a FQCN will contain only a single quote, since namespaces are different. Not a big deal. |
b914980
to
56a74ed
Compare
5d29751
to
7220038
Compare
7220038
to
e9e0c07
Compare
Thank you @GromNaN. |
This PR was merged into the 5.4 branch. Discussion ---------- [Console] [AppVeyor] Fix EOL in the tests | Q | A | ------------- | --- | Branch? | 5.4 <!-- see below --> | Bug fix? | yes | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | License | MIT [Probably caused by this fix](#43665) AppVeyor run tests on Windows and tests with EOL [failing](https://ci.appveyor.com/project/fabpot/symfony/builds/41346183#L1559)  `@derrabus` pls review Commits ------- d4a9e6e [Console][AppVeyor] Fix EOL in the tests
Fully tested code with #43598
printf
options%b
and%q
are handy to escape string using in shell input.bin/console debug:form App\\Form\\CommentType
). Otherwise they are dropped when PHP receive the argument (App\Form\CommentType
becomeAppFormCommentType
in$SERVER['argv']
). This is not necessary for quoted arguments (bin/console debug:form "App\Form\CommentType"
is OK). In the context of a command stored in a variable, like in the bash script, escaping is not interpreted: we must replace\\
by\
usingprintf '%b'
.App\\Form\\
is typed, the suggestions must contain a\\
to match. Since these values are provided to shell, double backslash must be escaped:\
becomes\\\\
in suggestion output.screen-autocomplete-backslash.mov