Read from and write to the `hosts.yml` file every time `config.yml` is
accessed. Everything that before went under the `hosts:` map now belongs
to `hosts.yml`.
Previously we would trigger OAuth flow when the config file did not
exist. Now we will let an empty Config object be initialized in that
case, but trigger OAuth flow when the Context caller requests an
AuthToken.
When executing `gh pr re` (note the incomplete command name), Cobra
would just display the help text for `gh pr` on standard output, exit
with status 0, and not print any message that you have mistyped the
"re" subcommand. Each part of this behavior is wrong.
This workaround makes sure that the helpful error message is printed on
stderr:
$ gh pr re
unknown command "re" for "gh pr"
Did you mean this?
reopen
ready
review
However, the exit status is still 0, whereas it should be non-zero.
Since `HelpFunc` does not return an error argument, we cannot trigger an
error status from this workaround.
The login name of the authenticated user will be readily available only
if authentication info comes from the config file. With other upcoming
authentication modes (for example, the GITHUB_TOKEN environment
variable), the token is the only piece of information we got, so we
would need to additionally query for the login name.
Since `issue status` and `pr status` are the only commands that need the
name of the authenticated user right now, have those commands explicitly
query for the login name. This results in an additional API query, but
simplifies Context implementation and future authentication approaches.