aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bash-completion.sh10
1 files changed, 4 insertions, 6 deletions
diff --git a/bash-completion.sh b/bash-completion.sh
index d07e3ed..536ca2d 100644
--- a/bash-completion.sh
+++ b/bash-completion.sh
@@ -36,9 +36,8 @@ _icevault() {
local p
# list sockets (and dirs) only
- if { [ $OPTIND -eq $(( $cword + 1)) ] && [ "$prev" = -s ]; } ||
- { [ $OPTIND -eq $cword ] && [[ "$cur" =~ ^--socket= ]]; }; then
- { [ $OPTIND -eq $cword ] && [[ "$cur" =~ ^--socket= ]]; } && cur="${cur#--socket=}"
+ if [[ $OPTIND -eq $(( $cword + 1)) && "$prev" = -s ]] || [[ $OPTIND -eq $cword && "$cur" =~ ^--socket= ]]; then
+ [[ $OPTIND -eq $cword && "$cur" =~ ^--socket= ]] && cur="${cur#--socket=}"
_filedir
files=( "${COMPREPLY[@]}" )
COMPREPLY=()
@@ -56,8 +55,7 @@ _icevault() {
[ $(($OPTIND + 1)) -lt $cword ] && return
local colon_word=
- if [ -z "$cur" -a $OPTIND -eq $cword ] ||
- [ -z "$cur" -a $(($OPTIND + 1)) -eq $cword -a "${words[OPTIND]}" = fill ]; then
+ 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")
@@ -72,7 +70,7 @@ _icevault() {
fi
local uri
- if [ $OPTIND -eq $cword ] || ! [[ "${words[OPTIND]}" =~ :// ]]; then
+ if [[ $OPTIND -eq $cword || ! "${words[OPTIND]}" =~ :// ]]; then
compopt -o filenames -o noquote
while read -r -d $'\0' uri; do
# quote manually (so we don't quote the : and =)