mirror of
https://github.com/openSUSE/osc.git
synced 2024-11-09 22:36:14 +01:00
Do not strip colon from COMP_WORDBREAKS (bnc#915037)
Work around the libreadline colon trouble if COMP_WORDBREAKS includes the colon as regular word break. Side effect is that user now do not see the full project name anymore but only the subprojects. Signed-off-by: Werner Fink <werner@suse.de>
This commit is contained in:
parent
a80b286ac9
commit
9f76dc0777
1
dist/complete.sh
vendored
1
dist/complete.sh
vendored
@ -1,7 +1,6 @@
|
||||
test -z "$BASH_VERSION" && return
|
||||
complete -o default _nullcommand >/dev/null 2>&1 || return
|
||||
complete -r _nullcommand >/dev/null 2>&1 || return
|
||||
COMP_WORDBREAKS="${COMP_WORDBREAKS//:}"
|
||||
test -s /usr/share/osc/complete && complete -o default -C /usr/share/osc/complete osc
|
||||
test -s /usr/lib64/osc/complete && complete -o default -C /usr/lib64/osc/complete osc
|
||||
test -s /usr/lib/osc/complete && complete -o default -C /usr/lib/osc/complete osc
|
||||
|
27
dist/osc.complete
vendored
27
dist/osc.complete
vendored
@ -6,7 +6,6 @@
|
||||
#
|
||||
# usage with bash
|
||||
#
|
||||
# COMP_WORDBREAKS="${COMP_WORDBREAKS//:}"
|
||||
# complete -C osc.complete osc
|
||||
#
|
||||
# Author: Werner Fink <werner@suse.de>
|
||||
@ -35,8 +34,10 @@ if test "/proc/$PPID/exe" -ef /bin/tcsh ; then
|
||||
let colon=0
|
||||
else
|
||||
COMMAND_LINE="${COMP_LINE:0:$COMP_POINT}"
|
||||
# let colon=1
|
||||
let colon=0
|
||||
case "$COMP_WORDBREAKS" in
|
||||
*:*) let colon=1
|
||||
esac
|
||||
[[ $COMMAND_LINE =~ \\: ]] && COMMAND_LINE="${COMMAND_LINE//\\:/:}"
|
||||
fi
|
||||
IFS="${IFS}="
|
||||
@ -104,7 +105,7 @@ projects ()
|
||||
local -a list
|
||||
local -a argv
|
||||
local -i argc=0
|
||||
local arg
|
||||
local arg cur
|
||||
for arg; do
|
||||
if test $arg == "--" ; then
|
||||
let argc++
|
||||
@ -113,15 +114,18 @@ projects ()
|
||||
argv[argc++]=$arg
|
||||
done
|
||||
shift $argc
|
||||
if test -n "$1" ; then
|
||||
list=($(command grep -E "^$1" ~/.osc.projects))
|
||||
cur="$1"
|
||||
if test -n "${cur}" ; then
|
||||
list=($(command grep -E "^${cur}" ~/.osc.projects))
|
||||
else
|
||||
list=($(command cat ~/.osc.projects))
|
||||
fi
|
||||
if ((colon)) ; then
|
||||
builtin compgen -W "${list[*]}" "$1"|sed -r 's@([^\\]):@\1\\:@g'
|
||||
local colon_word
|
||||
colon_word=${cur%${cur##*:}}
|
||||
builtin compgen -W "${list[*]}" -- "${cur}" | sed -r "s@^${colon_word}@@g"
|
||||
else
|
||||
builtin compgen -W "${list[*]}" -- ${1+"$@"}
|
||||
builtin compgen -W "${list[*]}" -- "${cur}"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -130,7 +134,7 @@ packages ()
|
||||
local -a list
|
||||
local -a argv
|
||||
local -i argc=0
|
||||
local arg
|
||||
local arg cur
|
||||
for arg; do
|
||||
if test $arg == "--" ; then
|
||||
let argc++
|
||||
@ -139,12 +143,13 @@ packages ()
|
||||
argv[argc++]=$arg
|
||||
done
|
||||
shift $argc
|
||||
if test -n "$1" ; then
|
||||
list=($(command osc ls ${argv[@]}|command grep -E "^$1"))
|
||||
cur="$1"
|
||||
if test -n "${cur}" ; then
|
||||
list=($(command osc ls ${argv[@]}|command grep -E "^${cur}"))
|
||||
else
|
||||
list=($(command osc ls ${argv[@]}))
|
||||
fi
|
||||
builtin compgen -W "${list[*]}" -- ${1+"$@"}
|
||||
builtin compgen -W "${list[*]}" -- "${cur}"
|
||||
}
|
||||
|
||||
repositories ()
|
||||
|
Loading…
Reference in New Issue
Block a user