Skip to content
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

[Console] Support completion for bash functions #48179

Merged
merged 1 commit into from Nov 19, 2022

Conversation

Chi-teck
Copy link
Contributor

@Chi-teck Chi-teck commented Nov 9, 2022

Q A
Branch 6.2
Bug fix? no
New feature yes
Deprecations no
License MIT

I often use bash functions as wrappers for executable files that live in vendor/bin. So that they can be executed from any location within a project. Symfony Console has recently added support for Bash completions but right now that only applies to executable files and aliases. This PR adds support for Bash functions.

@Chi-teck Chi-teck requested a review from chalasr as a code owner Nov 9, 2022
@carsonbot carsonbot added this to the 6.2 milestone Nov 9, 2022
@carsonbot
Copy link

carsonbot commented Nov 10, 2022

Hey!

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

Cheers!

Carsonbot

@GromNaN
Copy link
Member

GromNaN commented Nov 11, 2022

Hi @Chi-teck, can you provide an example of "bash function", so that we can test your change?

@Chi-teck
Copy link
Contributor Author

Chi-teck commented Nov 12, 2022

@GromNaN It could be a simple wrapper around any Symfony app that already have completions dumped.

  1. Dump completions for some existing application.
    /var/www/vendor/bin/some-app bash >> ~/.bash_completion
  2. Add the following Bash function to ~/.bashrc file.
function some-app() {
  /var/www/vendor/bin/some-app
}
  1. Log in and log out for the change to take effect.

Check if completions work for /var/www/vendor/bin/some-app and for some-app.

Copy link
Member

@GromNaN GromNaN left a comment

Thank you for the reproducer. I think the function should transmit the arguments so that the completion works.

function some-app() {
  /var/www/vendor/bin/some-app "$@"
}

@symfony/mergers I think this is a bugfix that should be merged in 5.4.

fabpot
fabpot approved these changes Nov 19, 2022
@fabpot fabpot changed the base branch from 6.2 to 5.4 Nov 19, 2022
@fabpot
Copy link
Member

fabpot commented Nov 19, 2022

Thank you @Chi-teck.

@fabpot fabpot force-pushed the bash-complete-function branch from 3b60ba1 to 1321278 Compare Nov 19, 2022
@fabpot fabpot merged commit 5882b4f into symfony:5.4 Nov 19, 2022
4 of 6 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.

None yet

5 participants