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

When AddCmd.Completer() returns an array with many strings, auto-completion prints a lot of text #101

Open
ghost opened this issue Oct 17, 2018 · 2 comments

Comments

@ghost
Copy link

ghost commented Oct 17, 2018

Hi.

First, I would like to say that the ishell module is great and very easy to use
:)

Mu problem description:
I wrote a simple CLI and I added an auto-completion to one of my commands.
The command.Completer() method returns an array with many entries (~50K),
but there is a very low number of prefixes common to them.

When I press the "tab", after I'm writing the command token,
the auto-complete prints all those options, and this takes a lot of time...

Is there is a better way to handle this?
It would have been nice if only the prefixes would have printed and not all of the options.

Thank you
Dotan

@abiosoft
Copy link
Owner

abiosoft commented Oct 17, 2018

I have to admit I didn't have complex use case at the time and simply came up with something that worked for my use case.

The alternative would be to implement readline.AutoCompleter directly.

Is your code public? Or can you share a snippet that led to that scenario. That will help me in working towards something better.

@ghost
Copy link
Author

ghost commented Oct 18, 2018

Hi.

Thanks for the rapid response.

I added a python script that generates a go source which demonstrates the problem and a generated file,
I hope that this will help you.

generate_code.zip

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

1 participant