Closed marckhouzam closed 4 months ago
LGTM.
I have a minor concern regarding the short form for "tanzu" context. The format shown as
contextname[:<projectName>[:<spacename> | <clustername>]]
without explicitly mentioningproject:
before the project name (and similarly for space name or clustergroup name) may be confusing to users. I understand that adding them would make this short form string longer, and it seems you chose this for brevity. Perhaps we can proceed with this format and address any feedback accordingly.
Correct, I opted for brevity. I imagined a user using the short output in their shell prompt and I felt that this information is supposed to help quickly know where the CLI is pointing but does not have to be perfect. I expect that a user should be familiar with the names of the context, project and space so they should be able to understand the short form. But let's see if there are other opinions.
What this PR does / why we need it
This PR add a new
tanzu context current [--short]
command to easily show the current context.In preparation for the fact we plan on deprecating having two context active at the same time, the command only shows a single active context, prioritizing the
tanzu
ork8s
ones. This means that the new command command will only show an active TMC context if that is the only context active (if there are no tanzu or k8s context active).The command has to forms: long and short. The long form, triggered by default is:
Note that the
Organization
andProject
lines will only show for tanzu contexts.The
Kube Context
andKube Config
lines will only show for tanzu or k8s contexts. If a tanzu context has aspace
orcluster group
set, a line will be shown for it.The short form (
tanzu context current --short
):Note that
:<project>
and:<space | clustergroup>
will only shown fortanzu
context, and only if they are set.The PR updates the
go.mod
file to make use of the latest tanzu-plugin-runtime that allows to access the OrgName.Which issue(s) this PR fixes
Fixes #
Describe testing done for PR
Release note
Additional information
Special notes for your reviewer