google / oauth2l

oauth2l ("oauth tool") is a simple CLI for interacting with Google API authentication.
Apache License 2.0
651 stars 81 forks source link

Use exit code in addition of print for "test" #85

Closed kerneis closed 4 years ago

kerneis commented 4 years ago

The documentation mentions that "oauth2l test" returns 0 or 1, but the current code prints the value instead of setting an exit code. This is not useful for scripting.

This commit still keeps the printing part for backwards-compatibility reasons.

kerneis commented 4 years ago

The Python version used to have no output, which is what the document mentions as well: https://github.com/google/oauth2l/blob/master/python/oauth2l/oauth2l_test.py#L305

However, the switch to the go version in https://github.com/google/oauth2l/commit/7c859d8b1e382dd398753bfb191e26f45f282d5e happened more than a year ago. Although nobody opened a bug since then, Hyrum's law (https://www.hyrumslaw.com/) probably means that someone somewhere relies on it. This change restores the "exit code" behavior while keeping the print statement to ensure maximal backwards compatibility. Forked from discussion in https://github.com/google/oauth2l/pull/84.