Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:42.3:Staging:D
bash-completion
FOO-dir-completion-boo905348.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File FOO-dir-completion-boo905348.patch of Package bash-completion
--- bash_completion | 51 ++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 48 insertions(+), 3 deletions(-) --- bash_completion +++ bash_completion 2015-03-18 12:43:01.808831000 +0000 @@ -558,15 +558,16 @@ _quote_readline_by_ref() # _filedir() { - local i IFS=$'\n' xspec + local IFS=$'\n' xspec _tilde "$cur" || return 0 + _dollar "$cur" || return 0 local -a toks local quoted x tmp _quote_readline_by_ref "$cur" quoted - x=$( compgen -d -- "$quoted" ) && + x=$( compgen -d -- "$cur" ) && while read -r tmp; do toks+=( "$tmp" ) done <<< "$x" @@ -937,6 +938,41 @@ _tilde() return $result } +# Perform dollar ($) completion +# @return True (0) if completion needs further processing, +# False (> 0) if dollar is followed by a valid username, completions +# are put in COMPREPLY and no further processing is necessary. +_dollar() +{ + local s="" + local -i glob=0 + + shopt -q extglob && let glob++ + ((glob == 0)) && shopt -s extglob + + [[ "$COMP_LINE" == cd* ]] && s="/" + + case "$1" in + \$\(*|\`*) + COMPREPLY=($(compgen -c -P '$(' -S ")$s" -- ${1#??})) ;; + \$\{*) + COMPREPLY=($(compgen -v -P '${' -S "}$s" -- ${1#??})) ;; + \$*) + COMPREPLY=($(compgen -v -P '$' ${s:+-S $s} -- ${1#?})) ;; + *) + ((glob == 0)) && shopt -u extglob + return 0 + esac + + if ((${#COMPREPLY[@]} > 0)) ; then + ((${#COMPREPLY[@]} == 1)) && eval COMPREPLY=\(${COMPREPLY[@]}\) + else + eval COMPREPLY=\(${1}\) + fi + + ((glob == 0)) && shopt -u extglob + return ${#COMPREPLY[@]} +} # Expand variable starting with tilde (~) # We want to expand ~foo/... to /home/foo/... to avoid problems when @@ -1576,7 +1612,16 @@ complete -F _known_hosts traceroute trac _cd() { local cur prev words cword - _init_completion || return + _init_completion || { + if [[ ${#COMPREPLY[@]} -eq 1 ]]; then + local i=${COMPREPLY[0]} + if [[ "$i" == "$cur" && $i != "*/" ]]; then + _dollar "$i" || return + COMPREPLY[0]="${i%%/}/" + fi + fi + return + } local IFS=$'\n' i j k
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor