[Bash-completion-devel] [bash-completion-Bugs][311521] [PATCH] add slash instead of space after dir names in _filedir

bash-completion-bugs at alioth.debian.org bash-completion-bugs at alioth.debian.org
Mon Mar 2 16:59:43 UTC 2009


Bugs item #311521, was opened at 2009-03-02 16:59
Status: Open
Priority: 3
Submitted By: Martin von Gagern (gagern-guest)
Assigned to: Nobody (None)
Summary: [PATCH] add slash instead of space after dir names in _filedir 
Distribution: Gentoo
Originally reported in: None
Milestone: None
Status: None
Original bug number: 


Initial Comment:
I'm unhappy with how completions using _filedir handle directories: they append a space, not a slash. E.g. type "openssl x509 -in /et" and press tab. It will append "c " instead of "c/".

Some other completions, e.g. those shipped with subversion, return an empty COMPREPLY in those cases, falling back to default bash completion. As _filedir adds to the list, doesn't claim to provide the whole list all by itself, and seems to have other benefits besides, I fear simply clearing the list won't easily solve all problems.

I see no official way to tell bash that a given word is to be treated as a prefix, in order to prevent bash from adding a space. Barring modifications to bash itself, we need some way to trick bash into treating a word as incomplete. E.g. we might add "dir/" and "dir/." to the list of completions, so that "dir/" is the common prefix but not the only possible completion, thus preventing the space. This should only be done for single result tokens, as you would not want such artificial duplicate entries when there are multiple real entries to choose from, possibly displayed to the user in a list.

The attached patch against the main git branch addresses this issue.
It consists of the following three changes:
1. append / after directory names
2. omit directories from file listings to avoid duplicates
3. add dir/. if the list consists only of a single dir/ entry

----------------------------------------------------------------------

You can respond by visiting: 
http://alioth.debian.org/tracker/?func=detail&atid=413095&aid=311521&group_id=100114



More information about the Bash-completion-devel mailing list