-
Notifications
You must be signed in to change notification settings - Fork 72
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
Omit trailing space from completion #87
Comments
From my reading really the only way to achieve this is to use the The only place where this is needed is really for flags and arguments prediction functions. Sub commands pretty much always need a space so that isn't hard to just add. The downside to this is that existing prediction functions now need to append a space to their predictions. Trivial enough to add but annoying to need to know to add for existing functions. This could be added as a hook that appends a space to the return of all predictions but it would need a corresponding option for disabling it. The All of that gets rather convoluted unfortunately for a minimal feature. |
I'm not sure what exactly is the problem that you are trying to solve. I am not sure how |
Most flags are like this:
Once arg is predicted you want to make a new flag prediction and so a space is inserted. This space is inserted by the bash completion system that invokes the completion commands. Other times though, a flag might be like this:
Where Unfortunately the only way to control whether bash completion inserts a space, is via the options assigned to the completion. I believe a bash completion script can modify its own options, or at least the individual bash functions that would generate the completion may have separate options assigned to them. But since completion via this library is not that granular from the perspective of bash completion, it is difficult to modify the completion options. If you modify the
Then completions will occur without that space, unless the completion suggest itself has a trailing space. Does that help clarify both the problem and the potential implementation I was suggesting? I know its a very small detail and not really a big deal. I would understand if you close this as won't fix but I at least wanted to raise the use case on the off chance that someone sees it as desirable or sees a better way to implement the option. |
I see. |
I never followed up on this, but long ago I figured out an elegant work around from this SO answer: https://stackoverflow.com/questions/55842705/is-it-possible-to-modify-compopts-dynamically-from-an-external-completion-comman
|
When writing completion function in bash you can use
compopt -o nospace
to omit the trailing space from completed arguments.How could something like this be achieved using this library? Calling out to
compopt
from the predict function doesn't work.The text was updated successfully, but these errors were encountered: