* Merged Ubuntu changes:

- added quote(), quote_readline(), dequote() helper functions.
This commit is contained in:
David Paleino 2008-06-23 11:03:01 +02:00
parent c5dd1150fc
commit 5b304bb4d6
2 changed files with 27 additions and 0 deletions

View File

@ -188,6 +188,26 @@ _rl_enabled()
[[ "$( bind -v )" = *$1+([[:space:]])on* ]] [[ "$( bind -v )" = *$1+([[:space:]])on* ]]
} }
# This function shell-quotes the argument
quote()
{
echo \'${1//\'/\'\\\'\'}\' #'# Help vim syntax highlighting
}
# This function quotes the argument in a way so that readline dequoting
# results in the original argument
quote_readline()
{
local t="${1//\\/\\\\}"
echo \'${t//\'/\'\\\'\'}\' #'# Help vim syntax highlighting
}
# This function shell-dequotes the argument
dequote()
{
eval echo "$1"
}
# Get the word to complete # Get the word to complete
# This is nicer than ${COMP_WORDS[$COMP_CWORD]}, since it handles cases # This is nicer than ${COMP_WORDS[$COMP_CWORD]}, since it handles cases
# where the user is completing in the middle of a word. # where the user is completing in the middle of a word.

7
debian/changelog vendored
View File

@ -1,3 +1,10 @@
bash-completion (20080617.4) UNRELEASED; urgency=low
* Merged Ubuntu changes:
- added quote(), quote_readline(), dequote() helper functions.
-- David Paleino <d.paleino@gmail.com> Mon, 23 Jun 2008 11:00:04 +0200
bash-completion (20080617.3) unstable; urgency=low bash-completion (20080617.3) unstable; urgency=low
[ David Paleino ] [ David Paleino ]