mirror of
https://gitea.com/gitea/tea.git
synced 2024-12-25 10:29:44 +01:00
b868d30434
Co-authored-by: techknowlogick <hello@techknowlogick.com> Co-committed-by: techknowlogick <hello@techknowlogick.com>
48 lines
1.2 KiB
Go
48 lines
1.2 KiB
Go
// Copyright 2019 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package cmd
|
|
|
|
import (
|
|
"code.gitea.io/tea/cmd/organizations"
|
|
"code.gitea.io/tea/modules/context"
|
|
"code.gitea.io/tea/modules/print"
|
|
|
|
"github.com/urfave/cli/v2"
|
|
)
|
|
|
|
// CmdOrgs represents handle organization
|
|
var CmdOrgs = cli.Command{
|
|
Name: "organizations",
|
|
Aliases: []string{"organization", "org"},
|
|
Category: catEntities,
|
|
Usage: "List, create, delete organizations",
|
|
Description: "Show organization details",
|
|
ArgsUsage: "[<organization>]",
|
|
Action: runOrganizations,
|
|
Subcommands: []*cli.Command{
|
|
&organizations.CmdOrganizationList,
|
|
&organizations.CmdOrganizationCreate,
|
|
&organizations.CmdOrganizationDelete,
|
|
},
|
|
Flags: organizations.CmdOrganizationList.Flags,
|
|
}
|
|
|
|
func runOrganizations(cmd *cli.Context) error {
|
|
ctx := context.InitCommand(cmd)
|
|
if ctx.Args().Len() == 1 {
|
|
return runOrganizationDetail(ctx)
|
|
}
|
|
return organizations.RunOrganizationList(cmd)
|
|
}
|
|
|
|
func runOrganizationDetail(ctx *context.TeaContext) error {
|
|
org, _, err := ctx.Login.Client().GetOrg(ctx.Args().First())
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
print.OrganizationDetails(org)
|
|
return nil
|
|
}
|