Wednesday, 23 February 2022

TIL - Logging into IBM Cloud with fewer keystrokes

So, back in the day i.e. earlier today, this is how I'd log into IBM Cloud: -

ic login --apikey $(cat ~/keyfile_staging_payg.json | jq -r .apikey) -r us-south -a 

where I'm using cat and jq to parse a JSON document containing my API key: -

cat ~/keyfile_staging_payg.json | jq -r .apikey

Well, today I learned that I can do it in fewer keystrokes ...

ic login --apikey @keyfile_staging_payg.json -r us-south -a

In other words, I'm using @ rather than a combination of cat and jq.

Now, personally, I use aliases to make life even easier e.g.

testlogin='ic login --apikey @~/keyfile_staging_payg.json -c 19f41865a1cf430c918334d89f6b09b9 -r us-south -a'

where said aliases are defined in ~/.bash_profile or ~/.zshenv.

All of which is nice!

No comments:

More fun with pip

Again with the Python and pip  fun, this time on my Mac, where commands such as:  pip3 list and: - pip3 install --upgrade pip were failing w...