Shell completions do not work in zsh due to use of `mapfile`

Overview

In the Shell completion section of the GDK Commands doc it suggests adding a couple of lines for zsh. I added them but when I tried to use autocomplete in zsh, I got the following error:

> gdk <tab key>_gdk:37: command not found: mapfile
_gdk:37: command not found: mapfile
_gdk:37: command not found: mapfile

It appears that there is no zsh equivalent for mapfile.

Proposal (optional)

I’m not very keen at writing shell scripts, but I wonder if there is a way we can detect if the person is using bash or zsh and only use the built-in mapfile if they are running bash and use some manually written equivalent if they are running zsh.

Environment (optional)

  • Operating System: macOS
  • The contents of your gdk.yml (empty)
  • Ruby version: ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-darwin19]
  • GDK version: c00c27c