dwavesystems / dwave-cloud-client

A minimal implementation of the REST interface used to communicate with D-Wave Solver API (SAPI) servers.
https://docs.ocean.dwavesys.com/projects/cloud-client/en/stable/
Apache License 2.0
59 stars 40 forks source link

Add `--raw`/`-r` option to "get token" CLI commands #598

Open randomir opened 9 months ago

randomir commented 9 months ago

Currently, to fetch a specific project's SAPI token (for use in scripting), one can write:

dwave leap project token --project CODE --json | jq .token -r

and then use it like this, for example, to list available solvers:

DWAVE_API_TOKEN=$(dwave leap project token --project CODE --json | jq .token -r) dwave solvers -la

We can simplify the JSON filtering part, though, by introducing --raw/-r option that returns raw token string:

$ dwave leap project token --project CODE --raw
a66...fe

Similarly for dwave auth get <token-type> command.