.
OBS-URL: https://build.opensuse.org/package/show/shells/bash-completion?expand=0&rev=52
This commit is contained in:
parent
849850232b
commit
a34a5d95d4
@ -1,21 +1,85 @@
|
||||
---
|
||||
bash_completion | 8 ++++++++
|
||||
1 file changed, 8 insertions(+)
|
||||
bash_completion | 51 ++++++++++++++++++++++++++++++++++++++++++++++++---
|
||||
1 file changed, 48 insertions(+), 3 deletions(-)
|
||||
|
||||
--- bash_completion
|
||||
+++ bash_completion 2014-11-17 12:41:17.573518527 +0000
|
||||
@@ -565,6 +565,14 @@ _filedir()
|
||||
+++ 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
|
||||
|
||||
+ if [[ $cur =~ ^(\$\{?)([A-Za-z0-9_]*)/ ]]; then
|
||||
+ eval local dir="${cur%%/*}"
|
||||
+ if [[ -d "$dir" ]]; then
|
||||
+ cur="${dir}/${cur#*/}"
|
||||
+ [[ "$1" != -d ]] && set -- -d $@
|
||||
+ fi
|
||||
_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 tilde 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
|
||||
+
|
||||
_quote_readline_by_ref "$cur" quoted
|
||||
x=$( compgen -d -- "$quoted" ) &&
|
||||
while read -r tmp; do
|
||||
+ ((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
|
||||
|
||||
|
@ -1,3 +1,10 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Mar 18 12:45:23 UTC 2015 - werner@suse.de
|
||||
|
||||
- Port my dollar completion from /etc/profile.d/completion.bash to
|
||||
bash_completion which modifies FOO-dir-completion-boo905348.patch
|
||||
- Avoid negative cword position counter (boo#922758)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Nov 17 12:46:11 UTC 2014 - werner@suse.de
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package bash-completion
|
||||
#
|
||||
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||
# Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@ -31,8 +31,10 @@ Patch0: %{name}-%{version}.patch
|
||||
Patch1: pushd-completion-bnc818365.patch
|
||||
# PATCH-FIX-SUSE bnc#903362 -- tab completion for file names prints error
|
||||
Patch2: PS1-completion-boo903362.patch
|
||||
# PATCH-FIX-SUSE bnc#905348 -- tab completion with shell variable changes command line with backslash
|
||||
# PATCH-FIX-SUSE boo#905348 -- tab completion with shell variable changes command line with backslash
|
||||
Patch3: FOO-dir-completion-boo905348.patch
|
||||
# PATCH-FIX-SUSE boo#922758 -- avoid negative cword position counter
|
||||
Patch4: init-completion-boo922758.patch
|
||||
BuildRequires: pkg-config
|
||||
Requires: bash
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
@ -48,6 +50,7 @@ of the programmable completion feature of Bash 2.04 and later.
|
||||
%patch1 -b .p1
|
||||
%patch2 -b .p2
|
||||
%patch3 -b .p3
|
||||
%patch4 -b .p4
|
||||
|
||||
%build
|
||||
%configure
|
||||
|
15
init-completion-boo922758.patch
Normal file
15
init-completion-boo922758.patch
Normal file
@ -0,0 +1,15 @@
|
||||
---
|
||||
bash_completion | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- bash_completion
|
||||
+++ bash_completion 2015-03-18 12:47:45.114019106 +0000
|
||||
@@ -708,7 +708,7 @@ _init_completion()
|
||||
fi
|
||||
done
|
||||
|
||||
- [[ $cword -eq 0 ]] && return 1
|
||||
+ [[ $cword -le 0 ]] && return 1
|
||||
prev=${words[cword-1]}
|
||||
|
||||
[[ ${split-} ]] && _split_longopt && split=true
|
Loading…
Reference in New Issue
Block a user