From 626593c3712531c251c69be2e561a34da98cdcdf Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sat, 1 Dec 2018 02:19:46 +1300 Subject: Remove null-result guard from completion gens I don't believe these are needed anymore, or possibly ever were. --- bash/bash_completion.d/eds.bash | 10 ++-------- bash/bash_completion.d/man.bash | 10 ++-------- bash/bash_completion.d/mysql.bash | 10 ++-------- bash/bash_completion.d/pass.bash | 10 ++-------- bash/bash_completion.d/path.bash | 10 ++-------- bash/bash_completion.d/sd.bash | 10 ++-------- bash/bash_completion.d/td.bash | 10 ++-------- 7 files changed, 14 insertions(+), 56 deletions(-) diff --git a/bash/bash_completion.d/eds.bash b/bash/bash_completion.d/eds.bash index c8a238f6..0b5e34ea 100644 --- a/bash/bash_completion.d/eds.bash +++ b/bash/bash_completion.d/eds.bash @@ -29,14 +29,8 @@ _eds() { executables[${#executables[@]}]=${file##*/} done - # Print quoted entries, null-delimited, if there was at least one; - # otherwise, just print a null character to stop this hanging in Bash - # 4.4 - if ((${#executables[@]})) ; then - printf '%q\0' "${executables[@]}" - else - printf '\0' - fi + # Print quoted entries, null-delimited + printf '%q\0' "${executables[@]}" ) } complete -F _eds eds diff --git a/bash/bash_completion.d/man.bash b/bash/bash_completion.d/man.bash index f92dda95..fcf26436 100644 --- a/bash/bash_completion.d/man.bash +++ b/bash/bash_completion.d/man.bash @@ -69,14 +69,8 @@ _man() { pages=("${pages[@]%.@([glx]z|bz2|lzma|Z)}") pages=("${pages[@]%.[0-9]*}") - # Print quoted entries, null-delimited, if there was at least one; - # otherwise, just print a null character to stop this hanging in Bash - # 4.4 - if ((${#pages[@]})) ; then - printf '%q\0' "${pages[@]}" - else - printf '\0' - fi + # Print quoted entries, null-delimited + printf '%q\0' "${pages[@]}" ) } complete -F _man -o bashdefault -o default man diff --git a/bash/bash_completion.d/mysql.bash b/bash/bash_completion.d/mysql.bash index d88219bf..413f3386 100644 --- a/bash/bash_completion.d/mysql.bash +++ b/bash/bash_completion.d/mysql.bash @@ -35,14 +35,8 @@ _mysql() { cnfs=("${cnfs[@]#"$dirname"/}") cnfs=("${cnfs[@]%.cnf}") - # Print quoted entries, null-delimited, if there was at least one; - # otherwise, just print a null character to stop this hanging in Bash - # 4.4 - if ((${#cnfs[@]})) ; then - printf '%q\0' "${cnfs[@]}" - else - printf '\0' - fi + # Print quoted entries, null-delimited + printf '%q\0' "${cnfs[@]}" ) } complete -F _mysql -o bashdefault -o default mysql diff --git a/bash/bash_completion.d/pass.bash b/bash/bash_completion.d/pass.bash index 5d507133..4a814412 100644 --- a/bash/bash_completion.d/pass.bash +++ b/bash/bash_completion.d/pass.bash @@ -40,14 +40,8 @@ _pass() entries=("${entries[@]#"$passdir"/}") entries=("${entries[@]%.gpg}") - # Print quoted entries, null-delimited, if there was at least one; - # otherwise, just print a null character to stop this hanging in Bash - # 4.4 - if ((${#entries[@]})) ; then - printf '%q\0' "${entries[@]}" - else - printf '\0' - fi + # Print quoted entries, null-delimited + printf '%q\0' "${entries[@]}" ) } complete -F _pass pass diff --git a/bash/bash_completion.d/path.bash b/bash/bash_completion.d/path.bash index da867880..fcb57949 100644 --- a/bash/bash_completion.d/path.bash +++ b/bash/bash_completion.d/path.bash @@ -41,14 +41,8 @@ _path() { dirnames=("${COMP_WORDS[COMP_CWORD]}"*/) dirnames=("${dirnames[@]%/}") - # Print quoted entries, null-delimited, if there was at - # least one; otherwise, just print a null character to stop - # this hanging in Bash 4.4 - if ((${#dirnames[@]})) ; then - printf '%q\0' "${dirnames[@]}" - else - printf '\0' - fi + # Print quoted entries, null-delimited + printf '%q\0' "${dirnames[@]}" ) ;; diff --git a/bash/bash_completion.d/sd.bash b/bash/bash_completion.d/sd.bash index 9694de1f..2d2d8f22 100644 --- a/bash/bash_completion.d/sd.bash +++ b/bash/bash_completion.d/sd.bash @@ -41,14 +41,8 @@ _sd() { sibs[${#sibs[@]}]=$dirname done - # Print quoted sibs, null-delimited, if there was at least one; - # otherwise, just print a null character to stop this hanging in Bash - # 4.4 - if ((${#sibs[@]})) ; then - printf '%q\0' "${sibs[@]}" - else - printf '\0' - fi + # Print quoted sibling directories, null-delimited + printf '%q\0' "${sibs[@]}" ) } complete -F _sd sd diff --git a/bash/bash_completion.d/td.bash b/bash/bash_completion.d/td.bash index 377ef6ce..92927c28 100644 --- a/bash/bash_completion.d/td.bash +++ b/bash/bash_completion.d/td.bash @@ -29,14 +29,8 @@ _td() { fns=("$dir"/"${COMP_WORDS[COMP_CWORD]}"*) fns=("${fns[@]#"$dir"/}") - # Print quoted entries, null-delimited, if there was at least one; - # otherwise, just print a null character to stop this hanging in Bash - # 4.4 - if ((${#fns[@]})) ; then - printf '%q\0' "${fns[@]}" - else - printf '\0' - fi + # Print quoted entries, null-delimited + printf '%q\0' "${fns[@]}" ) } complete -F _td td -- cgit v1.2.3