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
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Formula/m/mise.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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).

lib.mkpath
touch lib/".disable-self-update"
(share/"fish"/"vendor_conf.d"/"mise-activate.fish").write <<~FISH
Expand Down
Loading