Skip to content

Commit

Permalink
Ignore command PreRun logic for tanzu context get-token command
Browse files Browse the repository at this point in the history
Signed-off-by: Prem Kumar Kalle <[email protected]>
  • Loading branch information
prkalle committed Apr 30, 2024
1 parent 79cfc16 commit 92c6b55
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions pkg/command/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,10 @@ func shouldSkipPrompts(cmd *cobra.Command) bool {
"tanzu pinniped-auth",
// Can be used to set the prompt on every shell command
"tanzu context current",
// This command is being invoked by the kubectl exec binary where the user doesn't
// get to see the prompts and the kubectl command execution just gets stuck, and it
// is very hard for users to figure out what is going wrong
"tanzu context get-token",
}
return isSkipCommand(skipCommands, cmd.CommandPath())
}
Expand All @@ -620,11 +624,14 @@ func shouldSkipEssentialPlugins(cmd *cobra.Command) bool {

// Can be used to set the prompt on every shell command
"tanzu context current",

// This command is being invoked by the kubectl exec binary where the user doesn't
// get to see the output, so it is better to avoid printing essential plugins
// installation messages
"tanzu context get-token",
"tanzu config eula",
"tanzu ceip-participation set",
// This command is being invoked by the kubectl exec binary where the user doesn't
// get to see the output so it is better to avoid prinint essential plugins
// get to see the output so, it is better to avoid printing essential plugins
// installation messages
"tanzu pinniped-auth",
// Avoid trying to install essential plugins when the user wants to remove all plugins.
Expand All @@ -650,6 +657,12 @@ func shouldSkipVersionCheck(cmd *cobra.Command) bool {
"tanzu version",
// Can be used to set the prompt on every shell command
"tanzu context current",
// This command is being invoked by the kubectl exec binary where the user doesn't
// get to see the output so, we should avoid printing the new version availability
"tanzu context get-token",
// This command is being invoked by the kubectl exec binary where the user doesn't
// get to see the output so, we should avoid printing the new version availability
"tanzu pinniped-auth",
}
return isSkipCommand(skipVersionCheckCommands, cmd.CommandPath())
}
Expand All @@ -666,6 +679,9 @@ func shouldSkipGlobalInit(cmd *cobra.Command) bool {
"tanzu version",
// Can be used to set the prompt on every shell command
"tanzu context current",
// This command is being invoked by the kubectl exec binary, and it is not interactive,
// so it should not trigger the global initialization of the CLI
"tanzu context get-token",
}
return isSkipCommand(skipGlobalInitCommands, cmd.CommandPath())
}
Expand Down

0 comments on commit 92c6b55

Please sign in to comment.