Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[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

Merged
fabpot merged 1 commit intosymfony:5.4fromIonBazan:console-suggestions
Oct 30, 2021

Conversation

@IonBazan
Copy link
Contributor

@IonBazanIonBazan commentedOct 20, 2021
edited
Loading

QA
Branch?5.4
Bug fix?no
New feature?yes
Deprecations?no
Tickets#43594
LicenseMIT
Doc PR-

Adding Bash completion for following commands:

  • debug:firewall
  • debug:form
  • debug:messenger
  • debug:router

Waiting for#43596 to be merged first as it adds testing utilities andDescriptorHelper::getFormats().

GromNaN reacted with thumbs up emoji
@carsonbot
Copy link

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

@IonBazanIonBazan marked this pull request as ready for reviewOctober 20, 2021 03:53
@carsonbotcarsonbot added this to the5.4 milestoneOct 20, 2021
@IonBazanIonBazan changed the title[Console] add suggestions for debug commands: firewall, form, messenger, router[Console][WIP] add suggestions for debug commands: firewall, form, messenger, routerOct 20, 2021
@IonBazanIonBazanforce-pushed theconsole-suggestions branch 2 times, most recently from623af59 to70fdfe3CompareOctober 20, 2021 09:57
@IonBazanIonBazan changed the title[Console][WIP] add suggestions for debug commands: firewall, form, messenger, router[Console] add suggestions for debug commands: firewall, form, messenger, routerOct 20, 2021
@carsonbot
Copy link

Hey!

I think@TimoBakx has recently worked with this code. Maybe they can help review this?

Cheers!

Carsonbot

@TimoBakx
Copy link
Member

TheDebugFirewallCommand part looks good. 👍

Copy link
Member

@GromNaNGromNaN left a comment
edited
Loading

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\\CommentType
RuntimeException: 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.

@IonBazan
Copy link
ContributorAuthor

@GromNaN these missing backslashes seem like an issue with the completion command escaping itself and input escaping. The suggestions provided by thedebug:form do contain the backslashes so it must be something wrong with the terminal or the completion engine. Are there any similar issues in other commands too?

@GromNaN
Copy link
Member

Same issue with backslashes in#43653.

@wouterj
Copy link
Member

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
Copy link
ContributorAuthor

@GromNaN please review again

@GromNaN
Copy link
Member

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.

IonBazan reacted with thumbs up emoji

@fabpot
Copy link
Member

Thank you@IonBazan.

IonBazan reacted with rocket emoji

@fabpotfabpot merged commit9fe0876 intosymfony:5.4Oct 30, 2021
fabpot added a commit that referenced this pull requestOct 30, 2021
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
@IonBazanIonBazan deleted the console-suggestions branchNovember 1, 2021 01:51
This was referencedNov 5, 2021
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@GromNaNGromNaNGromNaN requested changes

@fabpotfabpotfabpot approved these changes

@wouterjwouterjwouterj approved these changes

@chalasrchalasrAwaiting requested review from chalasrchalasr is a code owner

@srozesrozeAwaiting requested review from sroze

@xabbuhxabbuhAwaiting requested review from xabbuhxabbuh is a code owner

@ycerutoycerutoAwaiting requested review from ycerutoyceruto is a code owner

Assignees

No one assigned

Projects

None yet

Milestone

5.4

Development

Successfully merging this pull request may close these issues.

6 participants

@IonBazan@carsonbot@TimoBakx@GromNaN@wouterj@fabpot

[8]ページ先頭

©2009-2025 Movatter.jp