From af3409d746dc807c6159d25207da731a85a8e37f Mon Sep 17 00:00:00 2001 From: rsteube Date: Thu, 20 Jun 2019 11:11:19 +0200 Subject: [PATCH] bash 3.0 compability and return instead of exit --- bash_completions.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bash_completions.go b/bash_completions.go index 8aac92b14..f7f029bfd 100644 --- a/bash_completions.go +++ b/bash_completions.go @@ -72,7 +72,7 @@ __%[1]s_handle_reply() else allflags=("${flags[*]} ${two_word_flags[*]}") fi - mapfile -t COMPREPLY < <(compgen -W "${allflags[*]}" -- "$cur") + read -a COMPREPLY < <(compgen -W "${allflags[*]}" -- "$cur") if [[ $(type -t compopt) = "builtin" ]]; then [[ "${COMPREPLY[0]}" == *= ]] || compopt +o nospace fi @@ -122,10 +122,10 @@ __%[1]s_handle_reply() if [[ ${#must_have_one_flag[@]} -ne 0 ]]; then completions+=("${must_have_one_flag[@]}") fi - mapfile -t COMPREPLY < <(compgen -W "${completions[*]}" -- "$cur") + read -a COMPREPLY < <(compgen -W "${completions[*]}" -- "$cur") if [[ ${#COMPREPLY[@]} -eq 0 && ${#noun_aliases[@]} -gt 0 && ${#must_have_one_noun[@]} -ne 0 ]]; then - mapfile -t COMPREPLY < <(compgen -W "${noun_aliases[*]}" -- "$cur") + read -a COMPREPLY < <(compgen -W "${noun_aliases[*]}" -- "$cur") fi if [[ ${#COMPREPLY[@]} -eq 0 ]]; then @@ -160,7 +160,7 @@ __%[1]s_handle_filename_extension_flag() __%[1]s_handle_subdirs_in_dir_flag() { local dir="$1" - pushd "${dir}" >/dev/null 2>&1 && _filedir -d && popd >/dev/null 2>&1 || exit + pushd "${dir}" >/dev/null 2>&1 && _filedir -d && popd >/dev/null 2>&1 || return } __%[1]s_handle_flag()