Skip to content

Commit

Permalink
Minor help text and error msg updates
Browse files Browse the repository at this point in the history
  • Loading branch information
anujc25 committed Oct 7, 2024
1 parent b3f007f commit 76567f6
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion docs/cli/commands/tanzu.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The Tanzu CLI

### SEE ALSO

* [tanzu api-token](tanzu_api-token.md) - Manage API Tokens for Tanzu Platform
* [tanzu api-token](tanzu_api-token.md) - Manage API Tokens for Tanzu Platform Self-managed
* [tanzu completion](tanzu_completion.md) - Output shell completion code
* [tanzu config](tanzu_config.md) - Configuration for the CLI
* [tanzu context](tanzu_context.md) - Configure and manage contexts for the Tanzu CLI
Expand Down
4 changes: 2 additions & 2 deletions docs/cli/commands/tanzu_api-token.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## tanzu api-token

Manage API Tokens for Tanzu Platform
Manage API Tokens for Tanzu Platform Self-managed

### Options

Expand All @@ -11,5 +11,5 @@ Manage API Tokens for Tanzu Platform
### SEE ALSO

* [tanzu](tanzu.md) - The Tanzu CLI
* [tanzu api-token create](tanzu_api-token_create.md) - Create a new API Token for Tanzu Platform
* [tanzu api-token create](tanzu_api-token_create.md) - Create a new API Token for Tanzu Platform Self-managed

6 changes: 3 additions & 3 deletions docs/cli/commands/tanzu_api-token_create.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## tanzu api-token create

Create a new API Token for Tanzu Platform
Create a new API Token for Tanzu Platform Self-managed

```
tanzu api-token create [flags]
Expand All @@ -10,7 +10,7 @@ tanzu api-token create [flags]

```
# Create an API Token for the Tanzu Platform
# Create an API Token for the Tanzu Platform Self-managed
tanzu api-token create
# Note: The retrieved token can be used as the value of TANZU_API_TOKEN
Expand All @@ -25,5 +25,5 @@ tanzu api-token create [flags]

### SEE ALSO

* [tanzu api-token](tanzu_api-token.md) - Manage API Tokens for Tanzu Platform
* [tanzu api-token](tanzu_api-token.md) - Manage API Tokens for Tanzu Platform Self-managed

10 changes: 5 additions & 5 deletions pkg/command/apitoken.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
func newAPITokenCmd() *cobra.Command {
apiTokenCmd := &cobra.Command{
Use: "api-token",
Short: "Manage API Tokens for Tanzu Platform",
Short: "Manage API Tokens for Tanzu Platform Self-managed",
Aliases: []string{"apitoken"},
Annotations: map[string]string{
"group": string(plugin.SystemCmdGroup),
Expand All @@ -42,10 +42,10 @@ func newAPITokenCmd() *cobra.Command {
func newAPITokenCreateCmd() *cobra.Command {
createCmd := &cobra.Command{
Use: "create",
Short: "Create a new API Token for Tanzu Platform",
Short: "Create a new API Token for Tanzu Platform Self-managed",
Aliases: []string{},
Example: `
# Create an API Token for the Tanzu Platform
# Create an API Token for the Tanzu Platform Self-managed
tanzu api-token create
# Note: The retrieved token can be used as the value of TANZU_API_TOKEN
Expand All @@ -60,10 +60,10 @@ func newAPITokenCreateCmd() *cobra.Command {
func createAPIToken(cmd *cobra.Command, _ []string) (err error) {
c, err := config.GetActiveContext(types.ContextTypeTanzu)
if err != nil {
return errors.New("no active context of type `tanzu`. Please login to Tanzu Platform first to generate an API token")
return errors.New("no active context found for Tanzu Platform. Please login to Tanzu Platform first to generate an API token")
}
if c == nil || c.GlobalOpts == nil || c.GlobalOpts.Auth.Issuer == "" {
return errors.New("invalid active context of type `tanzu`. Please login to Tanzu Platform first to generate an API token")
return errors.New("invalid active context found for Tanzu Platform. Please login to Tanzu Platform first to generate an API token")
}
// Make sure it is of type tanzu with tanzuIdpType as `uaa` else return error
if idpType, exist := c.AdditionalMetadata[config.TanzuIdpTypeKey]; !exist || idpType != string(config.UAAIdpType) {
Expand Down
4 changes: 2 additions & 2 deletions pkg/command/apitoken_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ Please copy and save your token securely. Note that you will need to regenerate
context: nil,
tanzuLoginErr: nil,
wantErr: true,
errMsg: "no active context of type `tanzu`. Please login to Tanzu Platform first to generate an API token",
errMsg: "no active context found for Tanzu Platform. Please login to Tanzu Platform first to generate an API token",
},
{
name: "invalid active context",
Expand All @@ -138,7 +138,7 @@ Please copy and save your token securely. Note that you will need to regenerate
},
tanzuLoginErr: nil,
wantErr: true,
errMsg: "invalid active context of type `tanzu`. Please login to Tanzu Platform first to generate an API token",
errMsg: "invalid active context found for Tanzu Platform. Please login to Tanzu Platform first to generate an API token",
},
{
name: "invalid IDP type",
Expand Down

0 comments on commit 76567f6

Please sign in to comment.