aboutsummaryrefslogtreecommitdiffstats
path: root/cli
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2015-04-01 10:26:19 +0200
committerGuilhem Moulin <guilhem@fripost.org>2015-04-01 10:26:19 +0200
commit95f2edde30d77fa71b72ae728cbbd3b5b292d511 (patch)
treeb43f729585f5a060b0915ee234f134137400f75b /cli
parent6da9213a31752e2908a8b721cb88b6cd190d60f5 (diff)
Don't add trailing '/' when completing.
Diffstat (limited to 'cli')
-rw-r--r--cli/bash-completion.sh3
-rwxr-xr-xcli/icevault4
2 files changed, 3 insertions, 4 deletions
diff --git a/cli/bash-completion.sh b/cli/bash-completion.sh
index f3175b9..4bb01b9 100644
--- a/cli/bash-completion.sh
+++ b/cli/bash-completion.sh
@@ -91,7 +91,7 @@ _icevault() {
local trim=
if [ "$cmd" = fill -a \( $OPTIND -eq $cword -o $(( $OPTIND + 1)) -eq $cword \) -a -z "$cur" ]; then
- cur="$(icevault _geturi ${socket:+--socket="$socket"})"/ # get URI from webpage
+ cur="$( icevault _geturi ${socket:+--socket="$socket"} 2>/dev/null )"/ # get URI from webpage
elif [ -z "$cmd" -a "$cword" -eq 1 -a "$cur" ]; then
# autocomplete command
COMPREPLY+=( $(compgen -W "$commands" -- "$cur") )
@@ -117,7 +117,6 @@ _icevault() {
uri=$( echo "${uri#$trim}" | sed "s/[][\\{}*?~<>;'\"|&()\!$\` \t]/\\\\&/g" )
COMPREPLY+=( "$uri" )
done < <(icevault _complete -0 "$cur" 2>/dev/null)
- [ "${#COMPREPLY[@]}" -eq 1 -a "${COMPREPLY[0]: -1:1}" = / ] && compopt -o nospace
return 0
fi
}
diff --git a/cli/icevault b/cli/icevault
index 4848cd7..034bb9d 100755
--- a/cli/icevault
+++ b/cli/icevault
@@ -732,9 +732,9 @@ if ($COMMAND eq '_complete') {
if (all { /\A\Q$s\E:\/\/\Q$h\E\// } @matches) { # common host: list all ids
} elsif (all { /\A\Q$s\E:\/\// } @matches) { # common scheme: list only hosts
- s#/[^\P{Print}\/]+\z#/# foreach @matches;
+ s#/[^\P{Print}\/]+\z## foreach @matches;
} else { # no common scheme: list only schemes
- s#://[^\P{Graph}\/]+/[^\P{Print}\/]+\z#://# foreach @matches;
+ s#://[^\P{Graph}\/]+/[^\P{Print}\/]+\z## foreach @matches;
}
my %matches = map {($_ => 1)} grep defined, @matches;