Install only full path (no basename) completions for /etc/init.d/*.

This commit is contained in:
Ville Skyttä 2011-04-12 20:10:09 +03:00
parent dcf09d3c98
commit c42aa0b424
2 changed files with 2 additions and 6 deletions

View File

@ -8,6 +8,7 @@ bash-completion (2.x)
* Split rpm and rpmbuild completions and improve them both.
* Add $_backup_glob for matching various backup files.
* Load and general speedups.
* Install only full path (no basename) completions for /etc/init.d/*.
[ Guillaume Rousse ]
* added puppet completion, using work from Mathieu Parent (sathieudebian.org)

View File

@ -13,10 +13,6 @@ _service()
COMPREPLY=()
_get_comp_words_by_ref cur prev
# don't complete for things like killall, ssh and mysql if it's
# the standalone command, rather than the init script
[[ ${COMP_WORDS[0]} != @(*init.d/!(functions|~)|service) ]] && return 0
# don't complete past 2nd token
[ $COMP_CWORD -gt 2 ] && return 0
@ -34,8 +30,7 @@ _service()
} &&
complete -F _service service
for svc in /etc/init.d/*; do
[ ! -x "$svc" ] || complete -p "${svc##*/}" &>/dev/null || \
complete -F _service -o default "${svc##*/}"
[ -x "$svc" ] && complete -F _service $svc
done
unset svc