_man(): some systems (e.g. Mandrake) have bzipped man pages

_man(): remove code duplication
more file types for ee and xv
This commit is contained in:
ianmacd 2002-02-08 16:49:05 +00:00
parent c07198e692
commit 61a29b1fcc

View File

@ -2,7 +2,7 @@
# #
# <![CDATA[ # <![CDATA[
# #
# $Id: bash_completion,v 1.93 2002/02/06 19:02:53 ianmacd Exp $ # $Id: bash_completion,v 1.94 2002/02/08 17:49:05 ianmacd Exp $
# #
# Copyright (C) Ian Macdonald <ian@caliban.org> # Copyright (C) Ian Macdonald <ian@caliban.org>
# #
@ -50,7 +50,7 @@ complete -f -X '*.Z' compress znew
complete -f -X '!*.@(Z|gz|tgz|Gz)' gunzip zcmp zdiff zcat zegrep zfgrep zgrep \ complete -f -X '!*.@(Z|gz|tgz|Gz)' gunzip zcmp zdiff zcat zegrep zfgrep zgrep \
zless zmore zless zmore
complete -f -X '!*.Z' uncompress complete -f -X '!*.Z' uncompress
complete -f -X '!*.@(gif|jpg|jpeg|tif|tiff|png|GIF|JPG|TIF|TIFF|PNG|bmp)' ee xv complete -f -X '!*.@(gif|jpg|jpeg|tif|tiff|png|pbm|pgm|ppm|PBM|PGM|PPM|GIF|JPG|TIF|TIFF|PNG|bmp)' ee xv
complete -f -X '!*.@(?(e)ps|?(E)PS|?(e)ps.gz|pdf|PDF)' gv ggv complete -f -X '!*.@(?(e)ps|?(E)PS|?(e)ps.gz|pdf|PDF)' gv ggv
complete -f -X '!*.@(dvi|DVI)?(.@(gz|Z|bz2))' xdvi complete -f -X '!*.@(dvi|DVI)?(.@(gz|Z|bz2))' xdvi
complete -f -X '!*.@(dvi|DVI)' dvips dviselect dvitype complete -f -X '!*.@(dvi|DVI)' dvips dviselect dvitype
@ -309,25 +309,24 @@ _man()
cmd=`awk '{if ($1 ~ /^MANPATH/) \ cmd=`awk '{if ($1 ~ /^MANPATH/) \
print $(NF)"/man'$prev'/'$cur'*"}' /etc/man.config | \ print $(NF)"/man'$prev'/'$cur'*"}' /etc/man.config | \
sort -u` sort -u`
# strip off * from paths ending in /*
cmd=${cmd//\/\\*/\/}
# redirect stderr for when path doesn't exist
cmd="ls $cmd 2>/dev/null"
COMPREPLY=( $( eval $cmd ) )
# get basename of man pages
COMPREPLY=( ${COMPREPLY[@]##*/} )
# strip suffix from man pages
COMPREPLY=( ${COMPREPLY[@]%.gz} )
COMPREPLY=( ${COMPREPLY[@]%.*} )
else else
cmd=`awk '{if ($1 ~ /^MANPATH/) \ cmd=`awk '{if ($1 ~ /^MANPATH/) \
print $(NF)"/man?/'$cur'*"}' /etc/man.config | sort -u` print $(NF)"/man?/'$cur'*"}' /etc/man.config | sort -u`
cmd=${cmd//\/\\*/\/} fi
cmd="ls $cmd 2>/dev/null"
COMPREPLY=( $( eval $cmd ) ) # strip off * from paths ending in /*
COMPREPLY=( ${COMPREPLY[@]##*/} ) cmd=${cmd//\/\\*/\/}
COMPREPLY=( ${COMPREPLY[@]%.gz} ) # redirect stderr for when path doesn't exist
COMPREPLY=( ${COMPREPLY[@]%.*} $( compgen -G $cur\*.[0-9ln] ) ) cmd="ls $cmd 2>/dev/null"
COMPREPLY=( $( eval $cmd ) )
# get basename of man pages
COMPREPLY=( ${COMPREPLY[@]##*/} )
# strip suffix from man pages
COMPREPLY=( ${COMPREPLY[@]%.@(gz|bz2)} )
COMPREPLY=( ${COMPREPLY[@]%.*} )
if [[ "$prev" != [0-9ln] ]]; then
COMPREPLY=( ${COMPREPLY[@]} $( compgen -G $cur\*.[0-9ln] ) )
fi fi
return 0 return 0