-
Notifications
You must be signed in to change notification settings - Fork 391
[WIP] Implemented custom auto-completion for Makefiles [Feedback wanted] #491
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
19fad7e
to
b431da0
Compare
c0e9459
to
09307f8
Compare
I have a question about this new feature. Have this special target If this has never been used in popular projects and there is no future plan to be adopted in popular projects, I'm not sure if At least, we need to promote it if you want it used by other people. If you are going to promote this one, I think it is more effective to create a separate small repository so that users can readily try it out by just copying it in their configuration folder rather than cloning the entire |
Hello @akinomyoga, tank you for the valuable feedback. As you proposed I will upload the patches to a separate repository and see if somebody is interested in this feature. |
Thank you! If you create a repository, gist, or whatever, you may add a link to your completion script in the recently-created wiki page of external completion scripts. |
@akinomyoga Thank you, the patch is now independently available under the following link: TobiasFaller/custom-makefile-completion. Could you please add it to the list of external completions in the Wiki?
|
Thank you for the information! I have added the entry in the list.
Letting users apply patches is a valid way to provide custom completion, but usually we provide users with the customization method through user's custom completion directory (
$ mkdir -p ~/.local/share/bash-completion/completions
$ wget https://raw.githubusercontent.com/TobiasFaller/custom-makefile-completion/main/custom-makefile-completion.bash
$ mv custom-makefile-completion.bash ~/.local/share/bash-completion/completions/make Or, with more robust script, #!/usr/bin/env bash
user_completion_dir=${BASH_COMPLETION_USER_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/bash-completion}/completions
url=https://raw.githubusercontent.com/TobiasFaller/custom-makefile-completion/main/custom-makefile-completion.bash
mkdir -p "$user_completion_dir"
wget "$url" -O "$user_completion_dir"/make
The usage examples are nice! |
This pull request introduces the ability to have a custom Makefile target that generates auto-completion input for the bash shell.
With this feature it is possible to customize the completion list that is displayed in the shell.
The Makefile target returns a space and newline separated list of custom completion options.
Since the Makefile has full control over the returned list it can add custom build targets which are not directly specified as a Makefile target.
Because this might have some security implications - executing the Makefile target on auto-completion - the feature is disabled by default.
Configuration options:
Example Makefile which implements a static list:
Example Makefile which implements an auto-generated list which is fed by bazel:
TODO:
Getting feedback if this feature makes sense and about the implementation would be nice.