From c3af0c31efbc23472a103536280a4d839555e198 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sat, 1 Dec 2018 02:32:30 +1300 Subject: Remove redundant error code in short circuits --- bash/bash_completion.d/bd.bash | 4 ++-- bash/bash_completion.d/ftp.bash | 2 +- bash/bash_completion.d/gpg.bash | 2 +- bash/bash_completion.d/man.bash | 2 +- bash/bash_completion.d/mysql.bash | 4 ++-- bash/bash_completion.d/pass.bash | 2 +- bash/bash_completion.d/sd.bash | 2 +- bash/bash_completion.d/ud.bash | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) (limited to 'bash') diff --git a/bash/bash_completion.d/bd.bash b/bash/bash_completion.d/bd.bash index 120080c3..e67cdd09 100644 --- a/bash/bash_completion.d/bd.bash +++ b/bash/bash_completion.d/bd.bash @@ -2,14 +2,14 @@ _bd() { # Only makes sense for the first argument - ((COMP_CWORD == 1)) || return 1 + ((COMP_CWORD == 1)) || return # Build a list of dirnames in $PWD local -a dirnames IFS=/ read -rd '' -a dirnames < <(printf '%s\0' "${PWD#/}") # Remove the last element in the array (the current directory) - ((${#dirnames[@]})) || return 1 + ((${#dirnames[@]})) || return dirnames=("${dirnames[@]:0:${#dirnames[@]}-1}") # Add the matching dirnames to the reply diff --git a/bash/bash_completion.d/ftp.bash b/bash/bash_completion.d/ftp.bash index d7ee8963..a584dd81 100644 --- a/bash/bash_completion.d/ftp.bash +++ b/bash/bash_completion.d/ftp.bash @@ -4,7 +4,7 @@ _ftp() { # Bail if the .netrc file is illegible local netrc netrc=$HOME/.netrc - [[ -r $netrc ]] || return 1 + [[ -r $netrc ]] || return # Tokenize the file local -a tokens diff --git a/bash/bash_completion.d/gpg.bash b/bash/bash_completion.d/gpg.bash index 0f6785f9..697e4a65 100644 --- a/bash/bash_completion.d/gpg.bash +++ b/bash/bash_completion.d/gpg.bash @@ -2,7 +2,7 @@ _gpg() { # Bail if no gpg(1) - hash gpg 2>/dev/null || return 1 + hash gpg 2>/dev/null || return # Bail if not completing an option case ${COMP_WORDS[COMP_CWORD]} in diff --git a/bash/bash_completion.d/man.bash b/bash/bash_completion.d/man.bash index 7574db40..e4175837 100644 --- a/bash/bash_completion.d/man.bash +++ b/bash/bash_completion.d/man.bash @@ -2,7 +2,7 @@ _man() { # Don't even bother if we don't have manpath(1) - hash manpath 2>/dev/null || return 1 + hash manpath 2>/dev/null || return # Snarf the word local word diff --git a/bash/bash_completion.d/mysql.bash b/bash/bash_completion.d/mysql.bash index 413f3386..3ff97090 100644 --- a/bash/bash_completion.d/mysql.bash +++ b/bash/bash_completion.d/mysql.bash @@ -2,12 +2,12 @@ _mysql() { # Only makes sense for first argument - ((COMP_CWORD == 1)) || return 1 + ((COMP_CWORD == 1)) || return # Bail if directory doesn't exist local dirname dirname=$HOME/.mysql - [[ -d $dirname ]] || return 1 + [[ -d $dirname ]] || return # Return the names of the .cnf files sans prefix as completions local db diff --git a/bash/bash_completion.d/pass.bash b/bash/bash_completion.d/pass.bash index 1df8dfb1..176886dc 100644 --- a/bash/bash_completion.d/pass.bash +++ b/bash/bash_completion.d/pass.bash @@ -8,7 +8,7 @@ _pass() # If we can't read the password directory, just bail local passdir passdir=${PASSWORD_STORE_DIR:-"$HOME"/.password-store} - [[ -r $passdir ]] || return 1 + [[ -r $passdir ]] || return # Iterate through list of .gpg paths, extension stripped, null-delimited, # and filter them down to the ones matching the completing word (compgen diff --git a/bash/bash_completion.d/sd.bash b/bash/bash_completion.d/sd.bash index 1194b33a..e7e82f80 100644 --- a/bash/bash_completion.d/sd.bash +++ b/bash/bash_completion.d/sd.bash @@ -2,7 +2,7 @@ _sd() { # Only makes sense for the first argument - ((COMP_CWORD == 1)) || return 1 + ((COMP_CWORD == 1)) || return # Current directory can't be root directory case $PWD in diff --git a/bash/bash_completion.d/ud.bash b/bash/bash_completion.d/ud.bash index 9ded41e6..5170eb57 100644 --- a/bash/bash_completion.d/ud.bash +++ b/bash/bash_completion.d/ud.bash @@ -2,7 +2,7 @@ _ud() { # Only makes sense for the second argument - ((COMP_CWORD == 2)) || return 1 + ((COMP_CWORD == 2)) || return # Iterate through directories, null-separated, add them to completions local dirname -- cgit v1.2.3