Have a method to prevent space from being added after an invalid one-res
From:
konsolebox
Subject:
Have a method to prevent space from being added after an invalid one-result completion
Date:
Fri, 17 Dec 2021 11:22:54 +0000
If I have a completion setup like this:
complete -F complete_something something
And then get complete_something to assign a single directory-only
result to COMPREPLY, I'd like the completion mechanism to not add a
space just so the user would know immediately that it isn't a valid
completion.
I hope a feature method or mechanism can be added as well to make this possible.
Running `compopt [+-]o nospace something` at the end of
complete_something doesn't help as it doesn't seem respected right
away. I also can't use `-o nospace` by default as I also complete
predictable non-file stuff.
I thought about excluding directories with no file children or
grandchildren as a workaround but this would be slow, use
unnecessarily large IO, and bring inconvenience to the user. It would
be better to show them an empty directory than let them wonder why
it's not appearing in the completions.
--
konsolebox