[Bash-completion-devel] [bash-completion-Bugs][313453] Enhancement request: Filtering out *_files/ dir for browsers.

bash-completion-bugs at alioth.debian.org bash-completion-bugs at alioth.debian.org
Sat Nov 26 09:03:30 UTC 2011


Bugs item #313453, was opened at 2011-11-26 09:03 by teika kazura
You can respond by visiting: 
https://alioth.debian.org/tracker/?func=detail&atid=413095&aid=313453&group_id=100114

Status: Open
Priority: 3
Submitted By: teika kazura (teika-guest)
Assigned to: Nobody (None)
Summary: Enhancement request: Filtering out *_files/ dir for browsers. 
Distribution: None
Originally reported in: None
Milestone: None
Status: None
Original bug number: 


Initial Comment:
Hi, it's an enhancement request. The current completion for browsers accepts all directories, but I think *_files/ are better to filter out.

I've been using the following function for half a year without problem, but I don't know if it's acceptable; I don't understand bash and sed well:
------------------------------------------------------------------------
function _browser_completion(){
    local -a f d

    d=( $( compgen -o dirnames ${COMP_WORDS[COMP_CWORD]} \
	| sed -e '/_files$/d') )
    f=( $( compgen -f ${COMP_WORDS[COMP_CWORD]} \
	| sed -n -e '/[xXsS]\?[hH][tT][mM][lL]\?$/p' ))
    COMPREPLY=( $(echo ${d[*]} ${f[*]} | sort ) )
}

# I only use firefox.
complete -o filenames -F _browser_completion firefox
------------------------------------------------------------------------

Thank you very much for maintaining bash-completion.

With best regards.

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

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



More information about the Bash-completion-devel mailing list