aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2015-03-20 13:18:57 +0100
committerGuilhem Moulin <guilhem@fripost.org>2015-03-20 13:18:57 +0100
commit7746c850acb53135b25161494b6fc980a8b9f7a9 (patch)
treebfe087a76446cc09072ee2787ac294903ad49df4
parentc791ca53d235380d10405eaa72b5aa7afc55c82f (diff)
wibble
-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 =)