When ran directly in the terminal, the command now errors out with:
$ gh completion
error: the value for `--shell` is required
see `gh completion --help` for more information
This is to avoid the previously default bash code output confusing the
user if they ran the command out of curiousity.
A backwards compatibility layer is present here: if stdout is not a
terminal, then output bash code like before. This is to support users
who have already added a line like this to their bash profile:
eval "$(gh completion)"