Improve aspell dictionary completion: don't hardcode data-dir, get canonical dicts from 'aspell dicts'.

This commit is contained in:
Ville Skyttä 2009-04-13 21:15:02 +03:00
parent 566c6083c2
commit 08d3738d56
2 changed files with 10 additions and 4 deletions

View File

@ -17,6 +17,8 @@ bash-completion (1.x)
* Parse top level mplayer and friends option completions from -list-options.
* Fix dir-only completion for make to include only dirs, not files.
* Remove unused variable RELEASE.
* Improve aspell dictionary completion: don't hardcode data-dir, get
canonical dicts from "aspell dicts".
[ Todd Zullinger ]
* Make yum complete on filenames after install, deplist, update and upgrade

View File

@ -6784,10 +6784,14 @@ have aspell && {
_aspell_dictionary()
{
local datadir
datadir=/usr/lib/aspell
COMPREPLY=( $( command ls $datadir/*.@(multi|alias) ) )
COMPREPLY=( ${COMPREPLY[@]%.@(multi|alias)} )
COMPREPLY=( $( compgen -W '${COMPREPLY[@]#$datadir/}' -- $cur ) )
datadir=$( aspell config data-dir 2>/dev/null || echo /usr/lib/aspell )
# First, get aliases (dicts dump does not list them)
COMPREPLY=( $( command ls $datadir/*.alias 2>/dev/null ) )
COMPREPLY=( ${COMPREPLY[@]%.alias} )
COMPREPLY=( ${COMPREPLY[@]#$datadir/} )
# Then, add the canonical dicts
COMPREPLY=( "${COMPREPLY[@]}" $( aspell dicts 2>/dev/null ) )
COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- $cur ) )
}
_aspell()