mirror of
https://github.com/spf13/cobra
synced 2024-12-28 07:17:06 +00:00
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
This commit is contained in:
parent
8e91712f17
commit
801364aa15
1 changed files with 1 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue