aboutsummaryrefslogtreecommitdiffstats
path: root/bash-completion.sh
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2015-03-20 16:13:08 +0100
committerGuilhem Moulin <guilhem@fripost.org>2015-03-20 16:13:08 +0100
commit135d72ac87f20a164c3e29de186dfa642d3b650b (patch)
tree738053299da8abd3c63af3b8e5b82e276bb4a2d3 /bash-completion.sh
parent8ec9c5f75200d7a54015cc3bd86cbe7a0836cc43 (diff)
wibble
Diffstat (limited to 'bash-completion.sh')
-rw-r--r--bash-completion.sh10
1 files changed, 5 insertions, 5 deletions
diff --git a/bash-completion.sh b/bash-completion.sh
index 536ca2d..34ed969 100644
--- a/bash-completion.sh
+++ b/bash-completion.sh
@@ -54,18 +54,18 @@ _icevault() {
fi
[ $(($OPTIND + 1)) -lt $cword ] && return
- local colon_word=
+ local trim=
if [ -z "$cur" -a $OPTIND -eq $cword ] || [ -z "$cur" -a $(($OPTIND + 1)) -eq $cword -a "${words[OPTIND]}" = fill ]; then
cur="$(./icevault _geturi)"/ # get URI from webpage
else
cur=$(dequote "$cur")
# trim words with : or = in $COMP_WORDBREAKS; see __ltrim_colon_completions
if [[ "$cur" == *[:=]* && "$COMP_WORDBREAKS" == *:* && "$COMP_WORDBREAKS" == *=* ]]; then
- colon_word=${cur%"${cur##*[:=]}"}
+ trim=${cur%"${cur##*[:=]}"}
elif [[ "$cur" == *:* && "$COMP_WORDBREAKS" == *:* ]]; then
- colon_word=${cur%"${cur##*:}"}
+ trim=${cur%"${cur##*:}"}
elif [[ "$cur" == *=* && "$COMP_WORDBREAKS" == *=* ]]; then
- colon_word=${cur%"${cur##*=}"}
+ trim=${cur%"${cur##*=}"}
fi
fi
@@ -74,7 +74,7 @@ _icevault() {
compopt -o filenames -o noquote
while read -r -d $'\0' uri; do
# quote manually (so we don't quote the : and =)
- uri=$( echo "${uri#$colon_word}" | sed "s/[][\\{}*?~<>;'\"|&()\!$\` \t]/\\\\&/g" )
+ uri=$( echo "${uri#$trim}" | sed "s/[][\\{}*?~<>;'\"|&()\!$\` \t]/\\\\&/g" )
COMPREPLY+=( "$uri" )
done < <(./icevault -0 _complete "$cur")
[ "${#COMPREPLY[@]}" -eq 1 -a "${COMPREPLY[0]: -1:1}" = / ] && compopt -o nospace