From 801364aa1521eb0ac9735f138901d5fe0f37b4b8 Mon Sep 17 00:00:00 2001 From: Anthony Fok Date: Fri, 5 Feb 2016 13:04:36 +0800 Subject: [PATCH] Skip "bash: declare: -A: invalid option" error gracefully The use of "declare -A flaghash" (associative array) was introduced in PR #205, which works perfectly for Bash 4.x, but OS X insists on shipping a very outdated Bash 3.2.x. This patch hides the "bash: declare: -A: invalid option" error message and allows the bash completion script to continue gracefully on OS X, albeit without the benefit of the new feature in PR #205. Fixes #240 --- bash_completions.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bash_completions.go b/bash_completions.go index 7457d858..131a59b7 100644 --- a/bash_completions.go +++ b/bash_completions.go @@ -219,7 +219,7 @@ func postscript(w io.Writer, name string) error { } _, err = fmt.Fprintf(w, `{ local cur prev words cword - declare -A flaghash + declare -A flaghash 2>/dev/null || : if declare -F _init_completion >/dev/null 2>&1; then _init_completion -s || return else