better CLI pathing for org vs org admin commands (#537)

This commit is contained in:
Michael Quigley 2024-12-10 13:56:52 -05:00
parent c3c318d529
commit a8ec61a8f9
No known key found for this signature in database
GPG Key ID: 9B60314A9DD20A62
2 changed files with 15 additions and 10 deletions

View File

@ -28,6 +28,7 @@ func init() {
rootCmd.AddCommand(adminCmd) rootCmd.AddCommand(adminCmd)
rootCmd.AddCommand(configCmd) rootCmd.AddCommand(configCmd)
rootCmd.AddCommand(modifyCmd) rootCmd.AddCommand(modifyCmd)
organizationCmd.AddCommand(organizationAdminCmd)
rootCmd.AddCommand(organizationCmd) rootCmd.AddCommand(organizationCmd)
rootCmd.AddCommand(shareCmd) rootCmd.AddCommand(shareCmd)
rootCmd.AddCommand(testCmd) rootCmd.AddCommand(testCmd)
@ -95,10 +96,15 @@ var modifyCmd = &cobra.Command{
Short: "Modify resources", Short: "Modify resources",
} }
var organizationAdminCmd = &cobra.Command{
Use: "admin",
Short: "Organization admin commands",
}
var organizationCmd = &cobra.Command{ var organizationCmd = &cobra.Command{
Use: "organization", Use: "organization",
Aliases: []string{"org"}, Aliases: []string{"org"},
Short: "Organization admin commands", Short: "Organization commands",
} }
var shareCmd = &cobra.Command{ var shareCmd = &cobra.Command{

View File

@ -11,26 +11,25 @@ import (
) )
func init() { func init() {
organizationCmd.AddCommand(newOrgAccountOverviewCommand().cmd) organizationAdminCmd.AddCommand(newOrgAdminOverviewCommand().cmd)
} }
type orgAccountOverviewCommand struct { type orgAdminOverviewCommand struct {
cmd *cobra.Command cmd *cobra.Command
} }
func newOrgAccountOverviewCommand() *orgAccountOverviewCommand { func newOrgAdminOverviewCommand() *orgAdminOverviewCommand {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "account-overview <organizationToken> <accountEmail>", Use: "overview <organizationToken> <accountEmail>",
Aliases: []string{"overview"}, Short: "Retrieve account overview for organization account (requires admin)",
Short: "Retrieve account overview for organization account (requires admin)", Args: cobra.ExactArgs(2),
Args: cobra.ExactArgs(2),
} }
command := &orgAccountOverviewCommand{cmd: cmd} command := &orgAdminOverviewCommand{cmd: cmd}
cmd.Run = command.run cmd.Run = command.run
return command return command
} }
func (cmd *orgAccountOverviewCommand) run(_ *cobra.Command, args []string) { func (cmd *orgAdminOverviewCommand) run(_ *cobra.Command, args []string) {
root, err := environment.LoadRoot() root, err := environment.LoadRoot()
if err != nil { if err != nil {
if !panicInstead { if !panicInstead {