@@ -2163,65 +2163,6 @@ _known_hosts_real()
21632163complete -F _known_hosts traceroute traceroute6 \
21642164 fping fping6 telnet rsh rlogin ftp dig drill mtr ssh-installkeys showmount
21652165
2166- # This meta-cd function observes the CDPATH variable, so that cd additionally
2167- # completes on directories under those specified in CDPATH.
2168- #
2169- _cd ()
2170- {
2171- local cur prev words cword comp_args
2172- _comp_initialize -- " $@ " || return
2173-
2174- if [[ $cur == -* ]]; then
2175- local cmd=$1
2176- _comp_compgen COMPREPLY -W ' $(_parse_help help "$cmd")' -- " $cur "
2177- compopt +o nospace
2178- return
2179- fi
2180-
2181- local IFS=$' \n ' i j k
2182-
2183- compopt -o filenames
2184-
2185- # Use standard dir completion if no CDPATH or parameter starts with /,
2186- # ./ or ../
2187- if [[ ! ${CDPATH-} || $cur == ? (.)? (.)/* ]]; then
2188- _filedir -d
2189- return
2190- fi
2191-
2192- local mark_dirs=" " mark_symdirs=" "
2193- _comp_readline_variable_on mark-directories && mark_dirs=y
2194- _comp_readline_variable_on mark-symlinked-directories && mark_symdirs=y
2195-
2196- # we have a CDPATH, so loop on its contents
2197- for i in ${CDPATH//:/ $' \n ' } ; do
2198- # create an array of matched subdirs
2199- k=${# COMPREPLY[@]}
2200- for j in $( compgen -d -- " $i /$cur " ) ; do
2201- if [[ ($mark_symdirs && -L $j || $mark_dirs && ! -L $j ) && ! -d ${j# " $i /" } ]]; then
2202- j+=" /"
2203- fi
2204- COMPREPLY[k++]=${j# " $i /" }
2205- done
2206- done
2207-
2208- _filedir -d
2209-
2210- if (( ${# COMPREPLY[@]} == 1 )) ; then
2211- i=${COMPREPLY[0]}
2212- if [[ $i == " $cur " && $i != " */" ]]; then
2213- COMPREPLY[0]=" ${i} /"
2214- fi
2215- fi
2216-
2217- return
2218- }
2219- if shopt -q cdable_vars; then
2220- complete -v -F _cd -o nospace cd pushd
2221- else
2222- complete -F _cd -o nospace cd pushd
2223- fi
2224-
22252166# A meta-command completion function for commands like sudo(8), which need to
22262167# first complete on a command, then complete according to that command's own
22272168# completion definition.
0 commit comments