8000 [Console] Support completion for bash functions by Chi-teck · Pull Request #48179 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Console] Support completion for bash functions #48179

8000 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

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.

@carsonbot
Copy link

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

@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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
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 November 19, 2022 14:44
@fabpot fabpot merged commit 5882b4f into symfony:5.4 Nov 19, 2022
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.

5 participants
0