From ae526b53f98f03748e0937cead3e164f60b7066e Mon Sep 17 00:00:00 2001 From: Rita Zerrizuela Date: Fri, 26 Feb 2021 12:01:29 -0300 Subject: [PATCH] Cleanup apps commands --- internal/cli/{clients.go => apps.go} | 29 ++++++++++++------- .../cli/{clients_test.go => apps_test.go} | 0 2 files changed, 18 insertions(+), 11 deletions(-) rename internal/cli/{clients.go => apps.go} (92%) rename internal/cli/{clients_test.go => apps_test.go} (100%) diff --git a/internal/cli/clients.go b/internal/cli/apps.go similarity index 92% rename from internal/cli/clients.go rename to internal/cli/apps.go index 237e15c97..bd58321cf 100644 --- a/internal/cli/clients.go +++ b/internal/cli/apps.go @@ -11,10 +11,18 @@ import ( "gopkg.in/auth0.v5/management" ) +const ( + appID = "id" + appName = "name" + appType = "type" + appDescription = "description" +) + func appsCmd(cli *cli) *cobra.Command { cmd := &cobra.Command{ - Use: "apps", - Short: "Manage resources for apps", + Use: "apps", + Short: "Manage resources for applications", + Aliases: []string{"clients"}, } cmd.SetUsageTemplate(resourceUsageTemplate()) @@ -28,15 +36,15 @@ func appsCmd(cli *cli) *cobra.Command { func appsListCmd(cli *cli) *cobra.Command { cmd := &cobra.Command{ Use: "list", - Short: "List your existing apps", + Short: "List your applications", Long: `auth0 apps list -Lists your existing apps. To create one try: +Lists your existing applications. To create one try: auth0 apps create `, RunE: func(cmd *cobra.Command, args []string) error { var list *management.ClientList - err := ansi.Spinner("Loading apps", func() error { + err := ansi.Spinner("Loading applications", func() error { var err error list, err = cli.api.Client.List() return err @@ -60,15 +68,14 @@ func appsDeleteCmd(cli *cli) *cobra.Command { } cmd := &cobra.Command{ Use: "delete", - Short: "Delete an existing app", - Long: `auth0 apps delete --name appName - -auth0 apps delete --app-id myapp + Short: "Delete an application", + Long: `Delete an application: +auth0 apps delete --id id `, RunE: func(cmd *cobra.Command, args []string) error { - if !cmd.Flags().Changed("app-id") { + if !cmd.Flags().Changed("id") { qs := []*survey.Question{ { Name: "AppID", @@ -95,7 +102,7 @@ auth0 apps delete --app-id myapp }, } - cmd.Flags().StringVarP(&flags.AppID, "app-id", "i", "", "app-id of the app.") + cmd.Flags().StringVarP(&flags.AppID, "id", "i", "", "Id of the app.") return cmd } diff --git a/internal/cli/clients_test.go b/internal/cli/apps_test.go similarity index 100% rename from internal/cli/clients_test.go rename to internal/cli/apps_test.go