commit bash-20200718 snapshot

This commit is contained in:
Chet Ramey
2020-07-20 16:20:22 -04:00
parent a57c6640e8
commit 5361749017
9 changed files with 302 additions and 140 deletions
+63
View File
@@ -0,0 +1,63 @@
complete -f -X '!*.+(ps|PS)' gs
complete -c nice
complete -e printenv
complete -c gdb
complete -f -X '!*.texi*' texi2html
complete -j -P '%' fg
complete -g groupmod
complete -f -X '!*.dvi' dvips
complete -f -X '!*.texi*' texi2dvi
complete -v -S '=' typeset
complete -f .
complete -c nohup
complete -a unalias
complete -g groupdel
complete -A hostname telnet
complete -v -S '=' declare
complete -v -S '=' export
complete -v -S '=' local
complete -v -S '=' readonly
complete -o bashdefault -o filenames -o nospace -F _comp_cd cd
complete -f -X '!*.dvi' xdvi
complete -c type
complete -f ln
complete -f -X '!*.+(gz|tgz)' gunzip
complete -f -X '!*.texi*' makeinfo
complete -u su
complete -j -P '%' jobs
complete -o dirnames -o filenames -o nospace -d popd
complete -A signal trap
complete -o dirnames -o filenames -o nospace -d pushd
complete -f -X '!*.pdf' acroread
complete -v unset
complete -f -X '!*.+(ps|PS)' ghostview
complete -j -W '$(ps -x | tail +2 | cut -c1-5)' -P '%' wait
complete -A hostname rsh
complete -c exec
complete -f -X '!*.Z' zmore
complete -A signal kill
complete -j -P '%' disown
complete -f -X '!*.+(ps|PS)' gs
complete -f -X '!*.+(ps|PS)' gv
complete -f source
complete -c make
complete -A stopped -P '%' bg
complete -f cat
complete -d mkdir
complete -A helptopic help
complete -c eval
complete -f chown
complete -v read
complete -c -k time
complete -f -X '!*.Z' zcat
complete -f gzip
complete -W '"${GROUPS[@]}"' newgrp
complete -f -X '!*.Z' uncompress
complete -d rmdir
complete -A shopt shopt
complete -A hostname ftp
complete -f more
complete -A hostname rlogin
complete -v getopts
complete -f -X '!*.+(gz|tgz)' gzcat
./complete.tests: line 123: complete: notthere: no completion specification
+126
View File
@@ -0,0 +1,126 @@
# Chet Ramey <chet.ramey@case.edu>
#
# Copyright 2002-2020 Chester Ramey
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# TThis program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
complete
# from zsh, just for testing
complete -A stopped -P '%' bg
complete -j -P '%' fg jobs disown
# this is wrong at this point
complete -j -P '%' -W '$(ps -x | tail +2 | cut -c1-5)' wait
complete -c type
complete -a unalias
complete -v getopts read unset
complete -v -S '=' declare export local readonly typeset
complete -f -- . source
complete -A shopt shopt
complete -e printenv
complete -A helptopic help
complete -c nohup exec nice eval
complete -c -k time
complete -A signal trap kill
complete -f chown ln more cat
complete -d mkdir rmdir
complete -f -X '!*.+(gz|tgz)' gunzip gzcat zcat zmore
complete -f -X '!*.Z' uncompress zmore zcat
complete -f gzip
complete -o dirnames -o filenames -o nospace -d pushd popd
_comp_cd()
{
local IFS=$' \t\n' # normalize IFS
local cur _skipdot _cdpath
local i j k
# Tilde expansion, with side effect of expanding tilde to full pathname
case "$2" in
\~*) eval cur="$2" ;;
*) cur=$2 ;;
esac
# no cdpath or absolute pathname -- straight directory completion
if [[ -z "${CDPATH:-}" ]] || [[ "$cur" == @(./*|../*|/*) ]]; then
# compgen prints paths one per line; could also use while loop
IFS=$'\n'
COMPREPLY=( $(compgen -d -- "$cur") )
IFS=$' \t\n'
# CDPATH+directories in the current directory if not in CDPATH
else
IFS=$'\n'
_skipdot=false
# preprocess CDPATH to convert null directory names to .
_cdpath=${CDPATH/#:/.:}
_cdpath=${_cdpath//::/:.:}
_cdpath=${_cdpath/%:/:.}
for i in ${_cdpath//:/$'\n'}; do
if [[ $i -ef . ]]; then _skipdot=true; fi
k="${#COMPREPLY[@]}"
for j in $( compgen -d -- "$i/$cur" ); do
COMPREPLY[k++]=${j#$i/} # cut off directory
done
done
$_skipdot || COMPREPLY+=( $(compgen -d -- "$cur") )
IFS=$' \t\n'
fi
# variable names if appropriate shell option set and no completions
if shopt -q cdable_vars && [[ ${#COMPREPLY[@]} -eq 0 ]]; then
COMPREPLY=( $(compgen -v -- "$cur") )
fi
# append slash to passed directory name that is the only completion.
# readline will not do this if we complete from CDPATH
if [[ ${#COMPREPLY[@]} -eq 1 ]]; then
i=${COMPREPLY[0]} # shorthand
if [[ "$cur" == "$i" ]] && [[ "$i" != "*/" ]]; then
COMPREPLY[0]+=/
fi
fi
return 0
}
complete -o filenames -o nospace -o bashdefault -F _comp_cd cd
complete -A hostname rsh telnet rlogin ftp
complete -u su
complete -W '"${GROUPS[@]}"' newgrp
complete -g groupdel groupmod
complete -f -X '!*.+(ps|PS)' gs gv ghostview
complete -f -X '!*.dvi' dvips xdvi
complete -f -X '!*.pdf' acroread
complete -f -X '!*.texi*' makeinfo texi2dvi texi2html
complete -c gdb make
complete -p gs
complete -p
complete -r xdvi
complete -r notthere
complete -r
complete
+2
View File
@@ -0,0 +1,2 @@
${THIS_SH} ./complete.tests > ${BASH_TSTOUT} 2>&1
diff ${BASH_TSTOUT} complete.right && rm -f ${BASH_TSTOUT}
+2
View File
@@ -24,3 +24,5 @@ ok 1
ok 2
ok 3
~root
foo=bar:/usr/xyz
foo=bar:~
+4
View File
@@ -85,4 +85,8 @@ USER=root # should exist just about everywhere
echo ~$USER
cd "$wdir"
echo foo=bar:~
set -o posix; echo foo=bar:~
exit 0