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

mise: fix shell completion #201741

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

robinbowes
Copy link
Contributor

  • Have you followed the guidelines for contributing?
  • Have you ensured that your commits follow the commit style guide?
  • Have you checked that there aren't other open pull requests for the same formula update/change?
  • Have you built your formula locally with HOMEBREW_NO_INSTALL_FROM_API=1 brew install --build-from-source <formula>, where <formula> is the name of the formula you're submitting?
  • Is your test running fine brew test <formula>, where <formula> is the name of the formula you're submitting?
  • Does your build pass brew audit --strict <formula> (after doing HOMEBREW_NO_INSTALL_FROM_API=1 brew install --build-from-source <formula>)? If this is a new formula, does it pass brew audit --new <formula>?

@github-actions github-actions bot added autosquash Automatically squash pull request commits according to Homebrew style. rust Rust use is a significant feature of the PR or issue labels Dec 19, 2024
@robinbowes robinbowes marked this pull request as ready for review December 19, 2024 09:24
mise shell completion requires the `--include-bash-completion-lib` option, as documented [here](https://mise.jdx.dev/cli/completion.html#include-bash-completion-lib)
@github-actions github-actions bot removed the autosquash Automatically squash pull request commits according to Homebrew style. label Dec 19, 2024
@@ -42,7 +42,7 @@ def install

system "cargo", "install", *std_cargo_args
man1.install "man/man1/mise.1"
generate_completions_from_executable(bin/"mise", "completion")
generate_completions_from_executable(bin/"mise", "completion", "--include-bash-completion-lib")
Copy link
Member

Choose a reason for hiding this comment

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

I think this will break for zsh and fish, only required for bash right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've just tested this and it only adds the extra libs if bash is specified.

So no, it doesn't break for other shells.

Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't this something that belongs in the user's .bash.rc? Looks like it's optional so the same library isn't sourced over-and-over at shell initialization. Maybe some clarification on what @jdx's (upstream) intention was with this flag would be helpful?

Additionally, does this work for both bash 3 and 5?

Copy link
Contributor

Choose a reason for hiding this comment

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

I thought homebrew had this as a separate package. How do other CLI's include it? I wouldn't think you'd want my vendored version

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It appears there are two bash-completion recipes, both sourced from https://github.com/scop/bash-completion

  • bash-completion (v1.3, for bash versions < 4.2)
  • bash-completion@2 (v2.15.0 for bash versions 4.2+)

I imagine it may be difficult to optionally install one of these packages when mise is installed?

Copy link
Contributor Author

@robinbowes robinbowes Dec 20, 2024

Choose a reason for hiding this comment

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

BTW, I can confirm that installing bash-completion@2 fixed mise completion for me (I'm on macos, but use bash 5 as my shell, installed from Homebrew).

@daeho-ro daeho-ro changed the title Fix mise shell completion mise: fix shell completion Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rust Rust use is a significant feature of the PR or issue shell-completion
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants