Conversation
auth token now respects --output text when explicitly set, outputting just the access token string suitable for piping. JSON remains the default for backward compatibility. Also returns write errors instead of discarding them. Co-authored-by: Isaac
Suggested reviewersBased on git history of the changed files, these people are best suited to review:
Confidence: low Eligible reviewersBased on CODEOWNERS, these people or teams could also review: @andrewnester, @anton-107, @denik, @shreyas-goenka Suggestions based on git history of 2 changed files (2 scored). See CODEOWNERS for path-specific ownership rules. |
renaudhartert-db
left a comment
There was a problem hiding this comment.
LGTM assuming resolution of the open comments.
Address review feedback: - writeTokenOutput now takes (io.Writer, *oauth2.Token, bool) instead of *cobra.Command, making it trivial to test without Cobra machinery - Replace complex command-level test with direct unit test of writeTokenOutput that compares exact output strings - Remove unused cobra and flags imports from test file Co-authored-by: Isaac
|
Addressed all three comments in c12e422.
Replaced the command-level test with a simple unit test that calls |
Why
auth tokenalways outputs JSON, ignoring the--outputflag. If you want to pipe just the token string into another tool, you have to parse JSON. That's unnecessary friction for a common scripting pattern.Changes
auth tokennow respects--output textwhen explicitly set, outputting just the access token string (with a trailing newline) suitable for piping. JSON remains the default for backward compatibility.Only honors the explicit
--output textflag, not implicit text mode (e.g. fromDATABRICKS_OUTPUT_FORMAT), so existing scripts that parse JSON output won't break.Also fixes discarded write errors (
_, _replaced with proper error returns).Test plan
--output json, and--output textmodescmd/authtests pass