From 7746c850acb53135b25161494b6fc980a8b9f7a9 Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Fri, 20 Mar 2015 13:18:57 +0100 Subject: wibble --- bash-completion.sh | 10 ++++------ 1 file 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 =) -- cgit v1.2.3