Skip to content

Commit a565d37

Browse files
fix: code review
1 parent 6d6519d commit a565d37

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

base-cli/cmd/common/auth/auth.go

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212
"time"
1313

1414
"github.com/golang-jwt/jwt/v5"
15-
"github.com/magaluCloud/mgccli/beautiful"
1615
"github.com/magaluCloud/mgccli/cmd/common/structs"
1716
"github.com/magaluCloud/mgccli/cmd/common/workspace"
1817
cmdutils "github.com/magaluCloud/mgccli/cmd_utils"
@@ -39,7 +38,7 @@ type Auth interface {
3938
GetSecretAccessKey() string
4039
GetService() *Service
4140
GetCurrentTenantID() (string, error)
42-
GetCurrentTenant(ctx context.Context, rawMode bool) (*Tenant, error)
41+
GetCurrentTenant(ctx context.Context) (*Tenant, error)
4342
GetScopes() (string, error)
4443
TokenClaims() (*TokenClaims, error)
4544

@@ -128,7 +127,7 @@ func (a *authValue) GetCurrentTenantID() (string, error) {
128127
return tenantId, nil
129128
}
130129

131-
func (a *authValue) GetCurrentTenant(ctx context.Context, rawMode bool) (*Tenant, error) {
130+
func (a *authValue) GetCurrentTenant(ctx context.Context) (*Tenant, error) {
132131
currentTenantId, err := a.GetCurrentTenantID()
133132
if err != nil {
134133
return nil, err
@@ -146,11 +145,7 @@ func (a *authValue) GetCurrentTenant(ctx context.Context, rawMode bool) (*Tenant
146145
}
147146
}
148147

149-
beautiful.NewOutput(rawMode).PrintError("O ID do tenant atual não foi encontrado na lista de tenants.")
150-
fmt.Fprintf(os.Stderr, "\nID: %s\nTenants:\n", currentTenantId)
151-
beautiful.NewOutput(rawMode).PrintData(tenants)
152-
153-
return nil, fmt.Errorf("tenant não foi encontrado na lista de tenants")
148+
return nil, fmt.Errorf("o ID (%s) do tenant atual não foi encontrado na lista de tenants", currentTenantId)
154149
}
155150

156151
func (a *authValue) GetScopes() (string, error) {

base-cli/cmd/static/auth/tenant/current.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func CurrentCommand(ctx context.Context) *cobra.Command {
3333
func runCurrent(ctx context.Context, rawMode bool) error {
3434
auth := ctx.Value(cmdutils.CTX_AUTH_KEY).(auth.Auth)
3535

36-
tenant, err := auth.GetCurrentTenant(ctx, rawMode)
36+
tenant, err := auth.GetCurrentTenant(ctx)
3737
if err != nil {
3838
return fmt.Errorf("erro ao pegar o tenant atual: %w", err)
3939
}

0 commit comments

Comments
 (0)