mirror of
https://gitea.com/gitea/tea.git
synced 2025-09-02 18:08:30 +02:00
Add tea org create <name>
(#420)
fixes #287, fixes #363 Co-authored-by: Norwin <git@nroo.de> Reviewed-on: https://gitea.com/gitea/tea/pulls/420 Reviewed-by: techknowlogick <techknowlogick@gitea.io> Reviewed-by: 6543 <6543@obermui.de> Co-authored-by: Norwin <noerw@noreply.gitea.io> Co-committed-by: Norwin <noerw@noreply.gitea.io>
This commit is contained in:
@ -5,9 +5,9 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"code.gitea.io/tea/cmd/organizations"
|
||||
"code.gitea.io/tea/modules/context"
|
||||
"code.gitea.io/tea/modules/print"
|
||||
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
@ -23,18 +23,26 @@ var CmdOrgs = cli.Command{
|
||||
Action: runOrganizations,
|
||||
Subcommands: []*cli.Command{
|
||||
&organizations.CmdOrganizationList,
|
||||
&organizations.CmdOrganizationCreate,
|
||||
&organizations.CmdOrganizationDelete,
|
||||
},
|
||||
Flags: organizations.CmdOrganizationList.Flags,
|
||||
}
|
||||
|
||||
func runOrganizations(ctx *cli.Context) error {
|
||||
func runOrganizations(cmd *cli.Context) error {
|
||||
ctx := context.InitCommand(cmd)
|
||||
if ctx.Args().Len() == 1 {
|
||||
return runOrganizationDetail(ctx.Args().First())
|
||||
return runOrganizationDetail(ctx)
|
||||
}
|
||||
return organizations.RunOrganizationList(ctx)
|
||||
return organizations.RunOrganizationList(cmd)
|
||||
}
|
||||
|
||||
func runOrganizationDetail(path string) error {
|
||||
return fmt.Errorf("Not yet implemented")
|
||||
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
|
||||
}
|
||||
|
Reference in New Issue
Block a user