observatorium / obsctl

A cli to interact with Observatorium instances.
Apache License 2.0
10 stars 14 forks source link

Command to show logged in user #13

Open stehessel opened 2 years ago

stehessel commented 2 years ago

CLI tools with login / logout commands often include commands to show the currently logged in user (see e.g. the Azure CLI tool https://docs.microsoft.com/en-us/cli/azure/account?view=azure-cli-latest).

So something like obsctl whoami or obsctl account show should return either the logged in user or Anonymous.

saswatamcode commented 2 years ago

I think we can output the current context here using obsctl context current which would show the name of the API and currently logged-in tenant. Is that what you are looking for here? 🙂

stehessel commented 2 years ago

Ah precisely, missed that option. Just tested it and the behavior is a bit weird

obsctl login ... --tenant=rhacs
obsctl logout --tenant=rhacs   # would be nice if it works without specifying tenant if there is only one
obsctl context current

Error: tenant with name rhacs doesn't exist in api staging
...

I think it should just state Anonymous or No context or something like that.