-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a new tanzu context current [--short]
command to easily show the current context
#750
Add a new tanzu context current [--short]
command to easily show the current context
#750
Conversation
eb3bc79
to
376907f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
I have a minor concern regarding the short form for "tanzu" context. The format shown as contextname[:<projectName>[:<spacename> | <clustername>]]
without explicitly mentioning project:
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a nit, lgtm!
pkg/command/context.go
Outdated
}, | ||
} | ||
|
||
currentCtxCmd.Flags().BoolVarP(&shortCtx, "short", "", false, "print a short form of the context suitable for prompts") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure we need to presume how this form might be used.
Maybe just "prints the context in compact form" is sufficient?
That said, an example of how it could be used for shell prompt might be worth mentioning in the markdown documentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the flag description.
As for documenting the prompt, since the format depends on the shell and some user choices (for example, I use RPROMPT
for this in zsh
and not the main PROMPT
), I simply put a note in the quickstart.md
file about the existence of tanzu context current --short
Signed-off-by: Marc Khouzam <marc.khouzam@broadcom.com>
Signed-off-by: Marc Khouzam <marc.khouzam@broadcom.com>
Signed-off-by: Marc Khouzam <marc.khouzam@broadcom.com>
Signed-off-by: Marc Khouzam <marc.khouzam@broadcom.com>
Signed-off-by: Marc Khouzam <marc.khouzam@broadcom.com>
376907f
to
ac742f5
Compare
…e current context (vmware-tanzu#750)
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 a
space
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