-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add --raw
/-r
option to "get token" CLI commands
#678
Add --raw
/-r
option to "get token" CLI commands
#678
Conversation
dwave auth get --raw dwave leap project token --raw
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #678 +/- ##
==========================================
+ Coverage 89.00% 89.01% +0.01%
==========================================
Files 44 44
Lines 4803 4817 +14
==========================================
+ Hits 4275 4288 +13
- Misses 528 529 +1 ☔ View full report in Codecov by Sentry. |
dwave/cloud/cli.py
Outdated
click.echo(orjson.dumps(info)) | ||
if raw_output and raw_stream.tell(): | ||
raw_stream.seek(0) | ||
click.echo(raw_stream.read()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why use StringIO
instead of just click.echo(info.get("raw"))
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could then also just have an elif instead
if raw_output:
...
elif json_output:
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason for using a string buffer here was to enable accumulation with output()
calls and dumping all at the end in flush()
, i.e. the same logic we use for JSON output. But we don't need buffering for the raw output at the moment, so sure, we can simplify the code a bit. Might go back to this implementation when/if we need buffered raw output from the CLI in the futuer.
7117b50
to
780ef26
Compare
Close #598.