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

Leverage existing bash completion #4020

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

Conversation

junegunn
Copy link
Owner

This is a PoC implementation for leveraging existing bash completion

Example: kubectl

image

However, when we select a command, fzf pastes the whole line to the command, which is definitely not what we want.

image

Example: git

image

This is a PoC implementation for leveraging existing bash completion

git **<tab>
kubectl **<tab>
@lincheney
Copy link
Contributor

I think you're running into something related to this spf13/cobra#1508, spf13/cobra#1509
I believe kubectl uses cobra which is adding those extra descriptions.
If you set an appropriate $COMP_TYPE cobra will stop doing it, but you will lose the descriptions e.g. lincheney/fzf-tab-completion@d88bf5b
or something like what ble.sh does where they detect and specially handle cobra completions akinomyoga/ble.sh@71d0736

@junegunn
Copy link
Owner Author

junegunn commented Mar 9, 2025

@lincheney Thank you for the tip. Your project looks very nice.

I have two problems with this:

  • I really like having the description and some extra information in the list. But because the formatting is not standardized, we can't safely extract the actual entry from each line. This is unfortunate.
  • If we just use the candidates from the existing bash completion, we lose the recursive traversal of the files under the current directory.

@junegunn junegunn mentioned this pull request Mar 12, 2025
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants