Skip to content

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