Send Basic auth Authorization header when requested.

Looks like the HTTP client won't send it up front, which does not play
well with some REST services (which won't return a 401). As a
workaround, manually set the Authorization header if basic auth has
been requested.
In CLI mode, if client method sets CLI_OUTPUT in state, use that as
the display output. This provides an opportunity for the method to
create human friendly output.

If not set, display raw response body as before.
Add is_cli() and also urlencode parameter values.
Move core initialization to rct_init so it can be used by both the
main rct CLI as well as user-defined CLI apps (via rct_cli_app).
A bit of logging cleanup.