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

Bash completion #89

Open
Skabit opened this issue Jan 20, 2021 · 4 comments
Open

Bash completion #89

Skabit opened this issue Jan 20, 2021 · 4 comments

Comments

@Skabit
Copy link

Skabit commented Jan 20, 2021

Hi @srsudar,

Please add bash completion (TAB) for eg:

eg fi<TAB>
eg find

I don't know how is the best way to implement that functionality, but as eg is a terminal tool the tab completion is a necessary feature.

@srsudar
Copy link
Owner

srsudar commented Jan 20, 2021

Hmm good idea. I'll do some investigating.

@Skabit
Copy link
Author

Skabit commented Jan 24, 2021

@srsudar thanks for the interest. I'm now a really fan of eg

@happytree718
Copy link

@srsudar,

I have been looking into the possibility of adding tab completion functionality to eg, and I've come up with a potential approach that I'd like to share.

Instead of using actual bash-completion (which could complicate the installation process and may not work across all platforms), I'm proposing a pseudo-completion scheme implemented at the Python level.

Here's how it would work: when a user types a partial command (like eg fi) and hits Enter, the program would scan through the examples-dir and custom-dir to find matches. If there are multiple prefix matches, it would print out all the matches to the users, allowing them to see their options. If there is an exact match or only one prefix match, it would directly execute it.

While this approach wouldn't provide the same experience as traditional tab completion, I believe it would be a helpful feature to improve the usability of eg. It would enable users to discover available commands more easily and complete their desired command without needing to type it out fully.

I'd be happy to work on implementing this feature if you think it would be a beneficial addition to the project. This is indeed a very helpful tool, thanks!

Looking forward to your thoughts,

Erwin

@srsudar
Copy link
Owner

srsudar commented Jun 7, 2023

I had forgotten about this issue! Thanks for resurrecting.

I think that the enter approach (as opposed to tab completion) would be a bit too unlike regular tab completion.

The easiest solution to me seems like including a zsh/sh function that uses eg --list and parses the output and passes it to `fzf link. That way fzf can handle all the tab completion stuff. Not quite as fancy as normal tab completion but it seems easier to me.

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

No branches or pull requests

3 participants