mirror of
https://github.com/openSUSE/osc.git
synced 2024-11-12 23:56:13 +01:00
Merge pull request #736 from lethliel/improve_bash_completion
improve speed of bash completion
This commit is contained in:
commit
93a5a4d353
11
dist/osc.complete
vendored
11
dist/osc.complete
vendored
@ -160,15 +160,14 @@ projects ()
|
|||||||
done
|
done
|
||||||
shift $argc
|
shift $argc
|
||||||
cur="$1"
|
cur="$1"
|
||||||
if test -n "${cur}" ; then
|
|
||||||
list=($(command grep -E "^${cur}" ${projects}))
|
|
||||||
else
|
|
||||||
list=($(command cat ${projects}))
|
|
||||||
fi
|
|
||||||
if ((colon)) ; then
|
if ((colon)) ; then
|
||||||
local colon_word
|
local colon_word
|
||||||
colon_word=${cur%${cur##*:}}
|
colon_word=${cur%${cur##*:}}
|
||||||
builtin compgen -W "${list[*]}" -- "${cur}" | sed -r "s@^${colon_word}@@g"
|
if test -n "${cur}" ; then
|
||||||
|
builtin compgen -W '`grep -E "^${cur}" ${projects}`' -- "${cur}" | sed -r "s@^${colon_word}@@g"
|
||||||
|
else
|
||||||
|
builtin compgen -W '`cat ${projects}`' -- "${cur}" | sed -r "s@^${colon_word}@@g"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
builtin compgen -W "${list[*]}" -- "${cur}"
|
builtin compgen -W "${list[*]}" -- "${cur}"
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user