-
Notifications
You must be signed in to change notification settings - Fork 14.1k
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
Breeze: Setup Autocomplete for Breeze #19967
Comments
I will pick this issue to work on first @potiuk |
A better approach would be to pre-generate completion scripts, and use pre-commit to keep everything in sync. This would eliminate most of the hacks (at runtime at least; all of those would only need to be able to generate a completion script). click-completion is another thing to look into that can help this. |
@uranusjr could you explain to me why we have to keep everything in sync using pre-commit? |
So when someone adds a new command, they can be automatically reminded to regenerate the autocompletion script. |
@potiuk I am planning to start this with one actual command and adding autocomplete for that one command and create help docs with that. Am i going in right direction? |
@uranusjr is right - Click completion is the right approach. And I aggre that the scripts should be automatically generated by .pre-commit.
Not even reminded - the scripts should be automatically regenerated. We have quite a few of those already - for example look here: airflow/.pre-commit-config.yaml Line 355 in cc3f038
In this case as pre-commit we should simply run generation of the scripts whenever the dev/breeze/src/airflow_breeze.py changes. See how to generate the scripts here: https://click.palletsprojects.com/en/7.x/bashcomplete/#activation-script Then I think we coud make (or find) the right way to update .zshrc/.bashrc etc with those activation commands (I guess someone had done that). |
@potiuk I have tried the above https://click.palletsprojects.com/en/7.x/bashcomplete/#activation-script script generation part and it works for me. Do I have to add that as the python script that generates autocompletion script in pre_commit like what is there for update-version? (like the one shown below) airflow/.pre-commit-config.yaml Line 357 in cc3f038
Also, you have mentioned that in pre-commit we should simply run generation of the scripts whenever the dev/breeze/src/airflow_breeze.py changes. How could I find out there are changes in this script file? The python script functionality would be to regenerate .bash/.zsh/.fsh and update in .zshrc/.bashrc/ I want to know if the first time generated .bash/.zsh/.fsh should be committed as part of the repository. |
Yeah. Just add a pre-commiit to generate the files and save them somewhere in There is no need to check if a file changes. Assuming that precommit generates the same script when you run it twice, pre-commit checks on it's own if the re-generated file changed or not. So it's ok to regenerate the file again and again only to find out that nothing changed (but in pre-commit definition you should specify that pre-commit should run only when the This can be done by adding If you add the "files" specification, checking if the matching files have chnged is done by |
We should leverage the 'click' functionality to get autocomplete working (https://click.palletsprojects.com/en/8.0.x/shell-completion/#) for
./Breeze2
command. The commands should come from the./dev/breeze/src/breeze.py
.This might require some hackery approach and might prove to be impossible or difficult, because it is based on entrypotnts and the fact that we want to use
Breeze2
command to run Airflow might not be well recognized by shell autocomplete.But I believe with proper naming of the commands/entrypoints we should be able to achieve it.
The result of this should be short instruction on how to make autocomplete for Breeze2 works (possibly with links to the documentation from click).
The text was updated successfully, but these errors were encountered: