Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Console] add suggestions for debug commands: firewall, form, messenger, router#43598
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
carsonbot commentedOct 20, 2021
Hey! To help keep things organized, we don't allow "Draft" pull requests. Could you please click the "ready for review" button or close this PR and open a new one when you are done? Note that a pull request does not have to be "perfect" or "ready for merge" when you first open it. We just want it to be ready for a first review. Cheers! Carsonbot |
623af59 to70fdfe3Comparecarsonbot commentedOct 20, 2021
Hey! I think@TimoBakx has recently worked with this code. Maybe they can help review this? Cheers! Carsonbot |
70fdfe3 to5c34db4CompareTimoBakx commentedOct 21, 2021
The |
GromNaN left a comment• edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Very nice, especially ondebug:form.
Namespace backslash are missing from completion.
$bin/console debug:formAppFormCommentType SymfonyComponentFormExtensionCoreTypeCheckboxType SymfonyComponentFormExtensionCoreTypeEmailType SymfonyComponentFormExtensionCoreTypePasswordType SymfonyComponentFormExtensionCoreTypeTextTypeAppFormPostType SymfonyComponentFormExtensionCoreTypeChoiceType SymfonyComponentFormExtensionCoreTypeFileType SymfonyComponentFormExtensionCoreTypePercentType SymfonyComponentFormExtensionCoreTypeTextareaTypeAppFormTypeChangePasswordType SymfonyComponentFormExtensionCoreTypeCollectionType SymfonyComponentFormExtensionCoreTypeFormType SymfonyComponentFormExtensionCoreTypeRadioType SymfonyComponentFormExtensionCoreTypeTimeTypeAppFormTypeDateTimePickerType SymfonyComponentFormExtensionCoreTypeColorType SymfonyComponentFormExtensionCoreTypeHiddenType SymfonyComponentFormExtensionCoreTypeRangeType SymfonyComponentFormExtensionCoreTypeTimezoneTypeAppFormTypeTagsInputType SymfonyComponentFormExtensionCoreTypeCountryType SymfonyComponentFormExtensionCoreTypeIntegerType SymfonyComponentFormExtensionCoreTypeRepeatedType SymfonyComponentFormExtensionCoreTypeUrlTypeAppFormUserType SymfonyComponentFormExtensionCoreTypeCurrencyType SymfonyComponentFormExtensionCoreTypeLanguageType SymfonyComponentFormExtensionCoreTypeResetType SymfonyComponentFormExtensionCoreTypeWeekTypeSymfonyBridgeDoctrineFormTypeEntityType SymfonyComponentFormExtensionCoreTypeDateIntervalType SymfonyComponentFormExtensionCoreTypeLocaleType SymfonyComponentFormExtensionCoreTypeSearchTypeSymfonyComponentFormExtensionCoreTypeBirthdayType SymfonyComponentFormExtensionCoreTypeDateTimeType SymfonyComponentFormExtensionCoreTypeMoneyType SymfonyComponentFormExtensionCoreTypeSubmitTypeSymfonyComponentFormExtensionCoreTypeButtonType SymfonyComponentFormExtensionCoreTypeDateType SymfonyComponentFormExtensionCoreTypeNumberType SymfonyComponentFormExtensionCoreTypeTelType
Option completion is very accurate with a class:
$bin/console debug:form App\Form\CommentTypeaction block_name csrf_message disabled getter invalid_message label_html priority trimallow_extra_fields block_prefix csrf_protection empty_data help invalid_message_parameters label_translation_parameters property_path upload_max_size_messageallow_file_upload by_reference csrf_token_id error_bubbling help_attr is_empty_callback legacy_error_messages required validation_groupsattr compound csrf_token_manager error_mapping help_html label mapped row_attrattr_translation_parameters constraints data extra_fields_message help_translation_parameters label_attr method setterauto_initialize csrf_field_name data_class form_attr inherit_data label_format post_max_size_message translation_domain
But fails if backslashes are escaped. I don't know if that should be supported:
$bin/console debug:form App\\Form\\CommentTypeRuntimeException: The autoloader expected class "App\\Form\\CommentType" to be defined in file "src//Form//CommentType.php". The file was found but the class was not in it, the class name or namespace probably has a typo.Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
IonBazan commentedOct 22, 2021
@GromNaN these missing backslashes seem like an issue with the completion command escaping itself and input escaping. The suggestions provided by the |
GromNaN commentedOct 22, 2021
Same issue with backslashes in#43653. |
wouterj commentedOct 22, 2021
I've proposed a (quite ugly) fix for the backslashes:#43664 I welcome more testers of this script, as I'm not sure how well this actually works (it works on my machine™) |
IonBazan commentedOct 27, 2021
@GromNaN please review again |
GromNaN commentedOct 27, 2021
LGTM. I used this PR to test#43665 and it worked very well. Regarding class types, the short names could have been completed in case someone type "ButtonType" for example. But name conflicts can appear and the completion made the FQCN lot easier to type. |
Uh oh!
There was an error while loading.Please reload this page.
71620f3 tocc315d4Comparefabpot commentedOct 30, 2021
Thank you@IonBazan. |
This PR was squashed before being merged into the 5.4 branch.Discussion----------[Console] Fix backslash escaping in bash completion| Q | A| ------------- | ---| Branch? | 5.4| Bug fix? | yes| New feature? | no| Deprecations? | no| Tickets |#43664| License | MIT| Doc PR | -Fully tested code with#43598- `printf` options `%b` and `%q` are handy to escape string using in shell input.- Backslashes must to be escaped (doubled) in normal input (`bin/console debug:form App\\Form\\CommentType`). Otherwise they are dropped when PHP receive the argument (`App\Form\CommentType` become `AppFormCommentType` 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 `\` using `printf '%b'`.- Completion does not process escaping. If `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.- I choose to detect when quotes are typed to allow them in completion and add quotes to suggestions.- Suggestion with spaces are still not properly working.https://user-images.githubusercontent.com/400034/138536102-e282ee75-56c8-414b-8b16-7c3c290276d7.movCommits-------e9e0c07 [Console] Fix backslash escaping in bash completion
Uh oh!
There was an error while loading.Please reload this page.
Adding Bash completion for following commands:
debug:firewalldebug:formdebug:messengerdebug:routerWaiting for#43596 to be merged first as it adds testing utilities andDescriptorHelper::getFormats().