diff --git a/pkg/koyeb/context.go b/pkg/koyeb/context.go index 339143c9..5b86b32c 100644 --- a/pkg/koyeb/context.go +++ b/pkg/koyeb/context.go @@ -16,7 +16,6 @@ const ( ctx_logs_client ctx_mapper ctx_renderer - ctx_organization ) // SetupCLIContext is called by the root command to setup the context for all subcommands. @@ -38,7 +37,6 @@ func SetupCLIContext(cmd *cobra.Command, organization string) error { ctx = context.WithValue(ctx, ctx_logs_client, logsApiClient) ctx = context.WithValue(ctx, ctx_mapper, idmapper.NewMapper(ctx, apiClient)) ctx = context.WithValue(ctx, ctx_renderer, renderer.NewRenderer(outputFormat)) - ctx = context.WithValue(ctx, ctx_organization, organization) cmd.SetContext(ctx) if organization != "" { @@ -53,25 +51,23 @@ func SetupCLIContext(cmd *cobra.Command, organization string) error { } type CLIContext struct { - Context context.Context - Client *koyeb.APIClient - LogsClient *LogsAPIClient - Mapper *idmapper.Mapper - Token string - Renderer renderer.Renderer - Organization string + Context context.Context + Client *koyeb.APIClient + LogsClient *LogsAPIClient + Mapper *idmapper.Mapper + Token string + Renderer renderer.Renderer } // GetCLIContext transforms the untyped context passed to cobra commands into a CLIContext. func GetCLIContext(ctx context.Context) *CLIContext { return &CLIContext{ - Context: ctx, - Client: ctx.Value(ctx_client).(*koyeb.APIClient), - LogsClient: ctx.Value(ctx_logs_client).(*LogsAPIClient), - Mapper: ctx.Value(ctx_mapper).(*idmapper.Mapper), - Token: ctx.Value(koyeb.ContextAccessToken).(string), - Renderer: ctx.Value(ctx_renderer).(renderer.Renderer), - Organization: ctx.Value(ctx_organization).(string), + Context: ctx, + Client: ctx.Value(ctx_client).(*koyeb.APIClient), + LogsClient: ctx.Value(ctx_logs_client).(*LogsAPIClient), + Mapper: ctx.Value(ctx_mapper).(*idmapper.Mapper), + Token: ctx.Value(koyeb.ContextAccessToken).(string), + Renderer: ctx.Value(ctx_renderer).(renderer.Renderer), } } diff --git a/pkg/koyeb/organizations_list.go b/pkg/koyeb/organizations_list.go index 9014f6ae..32f0e3c1 100644 --- a/pkg/koyeb/organizations_list.go +++ b/pkg/koyeb/organizations_list.go @@ -48,24 +48,22 @@ func (h *OrganizationHandler) List(ctx *CLIContext, cmd *cobra.Command, args []s } full := GetBoolFlags(cmd, "full") - reply := NewListOragnizationsReply(ctx.Mapper, &koyeb.ListOrganizationMembersReply{Members: list}, full, ctx.Organization) + reply := NewListOragnizationsReply(ctx.Mapper, &koyeb.ListOrganizationMembersReply{Members: list}, full) ctx.Renderer.Render(reply) return nil } type ListOrganizationsReply struct { - mapper *idmapper.Mapper - value *koyeb.ListOrganizationMembersReply - full bool - currentOrganization string + mapper *idmapper.Mapper + value *koyeb.ListOrganizationMembersReply + full bool } -func NewListOragnizationsReply(mapper *idmapper.Mapper, value *koyeb.ListOrganizationMembersReply, full bool, currentOrganization string) *ListOrganizationsReply { +func NewListOragnizationsReply(mapper *idmapper.Mapper, value *koyeb.ListOrganizationMembersReply, full bool) *ListOrganizationsReply { return &ListOrganizationsReply{ - mapper: mapper, - value: value, - full: full, - currentOrganization: currentOrganization, + mapper: mapper, + value: value, + full: full, } } @@ -78,7 +76,7 @@ func (r *ListOrganizationsReply) MarshalBinary() ([]byte, error) { } func (r *ListOrganizationsReply) Headers() []string { - return []string{"id", "name", "plan", "current"} + return []string{"id", "name", "plan"} } func (r *ListOrganizationsReply) Fields() []map[string]string { @@ -86,15 +84,10 @@ func (r *ListOrganizationsReply) Fields() []map[string]string { resp := make([]map[string]string, 0, len(items)) for _, member := range items { - current := "" - if member.Organization.GetId() == r.currentOrganization { - current = "✓" - } fields := map[string]string{ - "id": renderer.FormatID(member.Organization.GetId(), r.full), - "name": member.Organization.GetName(), - "plan": string(member.Organization.GetPlan()), - "current": current, + "id": renderer.FormatID(member.Organization.GetId(), r.full), + "name": member.Organization.GetName(), + "plan": string(member.Organization.GetPlan()), } resp = append(resp, fields) }