Skip to content

Add bazelisk completion bash/fish command#706

Merged
meteorcloudy merged 2 commits intobazelbuild:masterfrom
thii:completion
Jul 10, 2025
Merged

Add bazelisk completion bash/fish command#706
meteorcloudy merged 2 commits intobazelbuild:masterfrom
thii:completion

Conversation

@thii
Copy link
Member

@thii thii commented Jul 6, 2025

This command prints shell completion scripts for the active Bazel version. The completion scripts are downloaded on-demand and cached to Bazelisk CAS cache. This is to support generating completion scripts for older Bazel versions.

Closes #29

@thii thii marked this pull request as ready for review July 6, 2025 09:24
@thii
Copy link
Member Author

thii commented Jul 7, 2025

@fweikert @meteorcloudy Can you take a look?

@meteorcloudy
Copy link
Member

FYI, @fmeum is landing bazelbuild/bazel#26479 in Bazel. But I guess this is still useful to support older bazel versions? @fmeum Can you take a look since you are already working on this?

@fmeum
Copy link
Contributor

fmeum commented Jul 8, 2025

I will take a closer look tomorrow.

This does look like a pretty good "polyfill" for what bazel help completion bash will do in 8.4.0 and later.

What's the plan to handle the user switching between projects with different Bazel versions? Ideally bazelisk would always enable the completion script of the particular version of Bazel in use at the moment. Is that something you have thought about?

@thii
Copy link
Member Author

thii commented Jul 9, 2025

I actually haven't thought about that, just wanted to have an easy way to get the completion script of the correct bazel version (the completion script installed by system package managers like apt always installs the latest).

Copy link
Contributor

@fmeum fmeum left a comment

Choose a reason for hiding this comment

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

Makes sense, we can always add such a script later.

Could you add the basic snippets needed to enable the completion scripts for the two supported shells (based on bazelisk completion <shell>)?

Otherwise this looks good (and very well tested).

@thii thii requested a review from fmeum July 9, 2025 23:36
thii added 2 commits July 10, 2025 11:56
This command prints shell completion scripts for the active Bazel
version. The completion scripts are downloaded on-demand and cached to
Bazelisk CAS cache. This is to support generating completion scripts for
older Bazel versions.
@meteorcloudy meteorcloudy enabled auto-merge (squash) July 10, 2025 09:56
Copy link
Member

@meteorcloudy meteorcloudy left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution! And thanks @fmeum for reviewing!

@meteorcloudy meteorcloudy merged commit 8f6daef into bazelbuild:master Jul 10, 2025
2 checks passed
@thii thii deleted the completion branch July 10, 2025 11:12
@031282
Copy link

031282 commented Oct 6, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support bash autocomplete

5 participants