summaryrefslogtreecommitdiff
path: root/completions
diff options
context:
space:
mode:
authorIgor Murzov <e-mail@date.by>2011-11-17 04:02:35 +0300
committerIgor Murzov <e-mail@date.by>2011-11-17 04:02:35 +0300
commit82784121d863bede6b40433a52cceaabb79d7df6 (patch)
treec93ba333f02f7e4a9ec076f916fffb1e78085399 /completions
parent068a1a1b531a1c1823da496156a8bed17373c4ee (diff)
downloadbash-completion-82784121d863bede6b40433a52cceaabb79d7df6.tar.gz
upgradepkg: Support oldpackage%newpackage notation.
Diffstat (limited to 'completions')
-rw-r--r--completions/upgradepkg12
1 files changed, 12 insertions, 0 deletions
diff --git a/completions/upgradepkg b/completions/upgradepkg
index 06dbe571..59a27ca5 100644
--- a/completions/upgradepkg
+++ b/completions/upgradepkg
@@ -11,6 +11,18 @@ _upgradepkg()
return 0
fi
+ if [[ "$cur" == ?*%* ]]; then
+ prev="${cur%%?(\\)%*}"
+ cur="${cur#*%}"
+ local nofiles IFS=$'\n'
+ compopt -o filenames
+ COMPREPLY=( $( compgen -P "$prev%" -f -X "!*.@(t[bgxl]z)" -- "$cur" ) )
+ [[ $COMPREPLY ]] || nofiles=1
+ COMPREPLY+=( $( compgen -P "$prev%" -S '/' -d -- "$cur" ) )
+ [[ $nofiles ]] && compopt -o nospace
+ return 0
+ fi
+
_filedir "t[bglx]z"
} && complete -F _upgradepkg upgradepkg