civo / cli-rubygem

Command line interface for interacting with Civo's cloud API
https://www.civo.com
MIT License
15 stars 4 forks source link

Trap error when checking for current apikey if nil #48

Closed kaihoffman closed 4 years ago

kaihoffman commented 4 years ago

Checks whether a current key exists if the user calls apikey current and returns a friendly error if nil Closes #45

andyjeffries commented 4 years ago

I disagree with the change. I feel that adding a key should set it as the default (as the use case is you want to be using it, that's why you're adding it) and it should confirm that it did so. If there are NO apikeys, then maybe display an error, but if you happen to be in a state where you list apikeys and there's no default, set the first one to be default and then display it.

andyjeffries commented 4 years ago

Maybe the code to get the current apikey when making a request should error out if there is no default key. And the code to list all APIkeys should set the default AFTER telling you it's done so.

kaihoffman commented 4 years ago

Sorry to leave this hanging! Have implemented the following: