From 88a2018c2b256d276a0516aaf090a6df472e3082 Mon Sep 17 00:00:00 2001 From: Ewan Harris Date: Thu, 12 Jan 2023 11:27:23 +0000 Subject: [PATCH 1/6] DXCDT-326: align --number usage across commands --- CONTRIBUTING.md | 4 +-- docs/auth0_apis_list.md | 2 +- docs/auth0_apps_list.md | 2 +- docs/auth0_orgs_list.md | 2 +- docs/auth0_orgs_members_list.md | 2 +- docs/auth0_orgs_roles_list.md | 2 +- docs/auth0_orgs_roles_members_list.md | 2 +- docs/auth0_roles_list.md | 2 +- docs/auth0_roles_permissions_list.md | 6 ++-- internal/ansi/ansi.go | 2 +- internal/cli/apis.go | 12 ++++++- internal/cli/apps.go | 10 ++++-- internal/cli/organizations.go | 30 +++++++++++++--- internal/cli/roles.go | 12 ++++++- internal/cli/roles_permissions.go | 51 ++++++++++++++++++++------- 15 files changed, 108 insertions(+), 33 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9bb80cf68..f65d435fc 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -9,7 +9,7 @@ From the top-level directory: ``` $ make build -$ ./auth0 --help +$ ./out/auth0 --help ``` ## Adding a new command @@ -41,7 +41,7 @@ We use vendoring, so the last step is required. > This is only possible if you're a repository maintainer. -The release is driven by a Github **workflow** triggered when a new **tag** is **created**. The workflow will run the checks and trigger _Goreleaser_ to: +The release is driven by a GitHub **workflow** triggered when a new **tag** is **created**. The workflow will run the checks and trigger _Goreleaser_ to: - create the Release with the proper description (changelog) - upload the binaries for the different architectures - update https://github.com/auth0/homebrew-auth0-cli with the latest binary reference diff --git a/docs/auth0_apis_list.md b/docs/auth0_apis_list.md index 98a739fa6..a3de16fdd 100644 --- a/docs/auth0_apis_list.md +++ b/docs/auth0_apis_list.md @@ -24,7 +24,7 @@ auth0 apis list [flags] ``` --json Output in json format. - -n, --number int Number of apps to retrieve (default 50) + -n, --number int Number of APIs, that match the search criteria, to retrieve. Maximum result number is 1000. (default 50) ``` diff --git a/docs/auth0_apps_list.md b/docs/auth0_apps_list.md index a5789b903..c86e004ca 100644 --- a/docs/auth0_apps_list.md +++ b/docs/auth0_apps_list.md @@ -25,7 +25,7 @@ auth0 apps list [flags] ``` --json Output in json format. - -n, --number int Number of apps to retrieve (default 50) + -n, --number int Number of apps, that match the search criteria, to retrieve. Maximum result number is 1000. (default 50) -r, --reveal-secrets Display the application secrets ('signing_keys', 'client_secret') as part of the command output. ``` diff --git a/docs/auth0_orgs_list.md b/docs/auth0_orgs_list.md index b3af6ca13..c8bbb0c95 100644 --- a/docs/auth0_orgs_list.md +++ b/docs/auth0_orgs_list.md @@ -24,7 +24,7 @@ auth0 orgs list [flags] ``` --json Output in json format. - -n, --number int Number of apps to retrieve (default 50) + -n, --number int Number of organizations, that match the search criteria, to retrieve. Maximum result number is 1000. (default 50) ``` diff --git a/docs/auth0_orgs_members_list.md b/docs/auth0_orgs_members_list.md index b67062619..469c27cc3 100644 --- a/docs/auth0_orgs_members_list.md +++ b/docs/auth0_orgs_members_list.md @@ -24,7 +24,7 @@ auth0 orgs members list [flags] ``` --json Output in json format. - -n, --number int Number of apps to retrieve (default 50) + -n, --number int Number of organizations, that match the search criteria, to retrieve. Maximum result number is 1000. (default 50) ``` diff --git a/docs/auth0_orgs_roles_list.md b/docs/auth0_orgs_roles_list.md index 012913dc2..abcc9703a 100644 --- a/docs/auth0_orgs_roles_list.md +++ b/docs/auth0_orgs_roles_list.md @@ -24,7 +24,7 @@ auth0 orgs roles list [flags] ``` --json Output in json format. - -n, --number int Number of apps to retrieve (default 50) + -n, --number int Number of organizations, that match the search criteria, to retrieve. Maximum result number is 1000. (default 50) ``` diff --git a/docs/auth0_orgs_roles_members_list.md b/docs/auth0_orgs_roles_members_list.md index 829ac4fb7..17acc4086 100644 --- a/docs/auth0_orgs_roles_members_list.md +++ b/docs/auth0_orgs_roles_members_list.md @@ -26,7 +26,7 @@ auth0 orgs roles members list [flags] ``` --json Output in json format. - -n, --number int Number of apps to retrieve (default 50) + -n, --number int Number of organizations, that match the search criteria, to retrieve. Maximum result number is 1000. (default 50) -r, --role-id string Role Identifier. ``` diff --git a/docs/auth0_roles_list.md b/docs/auth0_roles_list.md index e8dc2a708..4fcade6e6 100644 --- a/docs/auth0_roles_list.md +++ b/docs/auth0_roles_list.md @@ -24,7 +24,7 @@ auth0 roles list [flags] ``` --json Output in json format. - -n, --number int Number of apps to retrieve (default 50) + -n, --number int Number of roles, that match the search criteria, to retrieve. Maximum result number is 1000. (default 50) ``` diff --git a/docs/auth0_roles_permissions_list.md b/docs/auth0_roles_permissions_list.md index b5d06e917..7de14993f 100644 --- a/docs/auth0_roles_permissions_list.md +++ b/docs/auth0_roles_permissions_list.md @@ -15,14 +15,16 @@ auth0 roles permissions list [flags] ``` auth0 roles permissions list auth0 roles permissions ls - auth0 roles permissions ls --json + auth0 roles permissions ls --number 100 + auth0 roles permissions ls -n 100 --json ``` ## Flags ``` - --json Output in json format. + --json Output in json format. + -n, --number int Number of permissions, that match the search criteria, to retrieve. Maximum result number is 1000. (default 50) ``` diff --git a/internal/ansi/ansi.go b/internal/ansi/ansi.go index b5ea92070..6491153ea 100644 --- a/internal/ansi/ansi.go +++ b/internal/ansi/ansi.go @@ -48,7 +48,7 @@ func Color() aurora.Aurora { // Initialize re-instantiates the Aurora instance // This initialization step is necessary because the parsing of the -// --no-color flag is done fairly late in the application cycle +// --no-color flag is done fairly late in the application cycle. func Initialize(shouldDisableColors bool) { DisableColors = shouldDisableColors color = Color() diff --git a/internal/cli/apis.go b/internal/cli/apis.go index abee9b8ff..0924f7727 100644 --- a/internal/cli/apis.go +++ b/internal/cli/apis.go @@ -54,6 +54,12 @@ var ( Help: "Whether Refresh Tokens can be issued for this API (true) or not (false).", AlwaysPrompt: true, } + apiNumber = Flag{ + Name: "Number", + LongForm: "number", + ShortForm: "n", + Help: "Number of APIs, that match the search criteria, to retrieve. Maximum result number is 1000.", + } ) func apisCmd(cli *cli) *cobra.Command { @@ -107,6 +113,10 @@ func listApisCmd(cli *cli) *cobra.Command { auth0 apis ls --number 100 auth0 apis ls -n 100 --json`, RunE: func(cmd *cobra.Command, args []string) error { + if inputs.Number < 1 || inputs.Number > 1000 { + return fmt.Errorf("number flag invalid, please pass a number between 1 and 1000") + } + list, err := getWithPagination( cmd.Context(), inputs.Number, @@ -139,7 +149,7 @@ func listApisCmd(cli *cli) *cobra.Command { } cmd.Flags().BoolVar(&cli.json, "json", false, "Output in json format.") - number.RegisterInt(cmd, &inputs.Number, defaultPageSize) + apiNumber.RegisterInt(cmd, &inputs.Number, defaultPageSize) return cmd } diff --git a/internal/cli/apps.go b/internal/cli/apps.go index 90b2a6014..e9fe02527 100644 --- a/internal/cli/apps.go +++ b/internal/cli/apps.go @@ -119,11 +119,11 @@ var ( ShortForm: "r", Help: "Display the application secrets ('signing_keys', 'client_secret') as part of the command output.", } - number = Flag{ + appNumber = Flag{ Name: "Number", LongForm: "number", ShortForm: "n", - Help: "Number of apps to retrieve", + Help: "Number of apps, that match the search criteria, to retrieve. Maximum result number is 1000.", } ) @@ -216,6 +216,10 @@ func listAppsCmd(cli *cli) *cobra.Command { auth0 apps list --reveal-secrets --number 100 auth0 apps ls -r -n 100 --json`, RunE: func(cmd *cobra.Command, args []string) error { + if inputs.Number < 1 || inputs.Number > 1000 { + return fmt.Errorf("number flag invalid, please pass a number between 1 and 1000") + } + list, err := getWithPagination( cmd.Context(), inputs.Number, @@ -244,7 +248,7 @@ func listAppsCmd(cli *cli) *cobra.Command { cmd.Flags().BoolVar(&cli.json, "json", false, "Output in json format.") revealSecrets.RegisterBool(cmd, &inputs.RevealSecrets, false) - number.RegisterInt(cmd, &inputs.Number, defaultPageSize) + appNumber.RegisterInt(cmd, &inputs.Number, defaultPageSize) return cmd } diff --git a/internal/cli/organizations.go b/internal/cli/organizations.go index f99f41dc8..828884002 100644 --- a/internal/cli/organizations.go +++ b/internal/cli/organizations.go @@ -77,6 +77,13 @@ var ( Help: "Role Identifier.", IsRequired: true, } + + organizationNumber = Flag{ + Name: "Number", + LongForm: "number", + ShortForm: "n", + Help: "Number of organizations, that match the search criteria, to retrieve. Maximum result number is 1000.", + } ) func organizationsCmd(cli *cli) *cobra.Command { @@ -117,6 +124,10 @@ func listOrganizationsCmd(cli *cli) *cobra.Command { auth0 orgs ls --json auth0 orgs ls -n 100`, RunE: func(cmd *cobra.Command, args []string) error { + if inputs.Number < 1 || inputs.Number > 1000 { + return fmt.Errorf("number flag invalid, please pass a number between 1 and 1000") + } + list, err := getWithPagination( cmd.Context(), inputs.Number, @@ -149,7 +160,7 @@ func listOrganizationsCmd(cli *cli) *cobra.Command { } cmd.Flags().BoolVar(&cli.json, "json", false, "Output in json format.") - number.RegisterInt(cmd, &inputs.Number, defaultPageSize) + organizationNumber.RegisterInt(cmd, &inputs.Number, defaultPageSize) return cmd } @@ -507,6 +518,10 @@ func listMembersOrganizationCmd(cli *cli) *cobra.Command { auth0 orgs members list --number 100 auth0 orgs members ls -n 100 --json`, RunE: func(cmd *cobra.Command, args []string) error { + if inputs.Number < 1 || inputs.Number > 1000 { + return fmt.Errorf("number flag invalid, please pass a number between 1 and 1000") + } + if len(args) == 0 { err := organizationID.Pick(cmd, &inputs.ID, cli.organizationPickerOptions) if err != nil { @@ -526,7 +541,7 @@ func listMembersOrganizationCmd(cli *cli) *cobra.Command { }, } - number.RegisterInt(cmd, &inputs.Number, defaultPageSize) + organizationNumber.RegisterInt(cmd, &inputs.Number, defaultPageSize) cmd.Flags().BoolVar(&cli.json, "json", false, "Output in json format.") cmd.SetUsageTemplate(resourceUsageTemplate()) @@ -565,6 +580,9 @@ func listRolesOrganizationCmd(cli *cli) *cobra.Command { auth0 orgs roles list --number 100 auth0 orgs roles ls -n 100 --json`, RunE: func(cmd *cobra.Command, args []string) error { + if inputs.Number < 1 || inputs.Number > 1000 { + return fmt.Errorf("number flag invalid, please pass a number between 1 and 1000") + } if len(args) == 0 { err := organizationID.Pick(cmd, &inputs.OrgID, cli.organizationPickerOptions) if err != nil { @@ -588,7 +606,7 @@ func listRolesOrganizationCmd(cli *cli) *cobra.Command { }, } - number.RegisterInt(cmd, &inputs.Number, defaultPageSize) + organizationNumber.RegisterInt(cmd, &inputs.Number, defaultPageSize) cmd.Flags().BoolVar(&cli.json, "json", false, "Output in json format.") @@ -628,6 +646,10 @@ func listMembersRolesOrganizationCmd(cli *cli) *cobra.Command { auth0 orgs roles members ls -r role -n 100 auth0 orgs roles members ls -r role -n 100 --json`, RunE: func(cmd *cobra.Command, args []string) error { + if inputs.Number < 1 || inputs.Number > 1000 { + return fmt.Errorf("number flag invalid, please pass a number between 1 and 1000") + } + if len(args) == 0 { err := organizationID.Pick(cmd, &inputs.OrgID, cli.organizationPickerOptions) if err != nil { @@ -661,7 +683,7 @@ func listMembersRolesOrganizationCmd(cli *cli) *cobra.Command { cmd.SetUsageTemplate(resourceUsageTemplate()) cmd.Flags().BoolVar(&cli.json, "json", false, "Output in json format.") roleIdentifier.RegisterString(cmd, &inputs.RoleID, "") - number.RegisterInt(cmd, &inputs.Number, defaultPageSize) + organizationNumber.RegisterInt(cmd, &inputs.Number, defaultPageSize) return cmd } diff --git a/internal/cli/roles.go b/internal/cli/roles.go index 6d1a4a368..3e87a3ee1 100644 --- a/internal/cli/roles.go +++ b/internal/cli/roles.go @@ -29,6 +29,12 @@ var ( ShortForm: "d", Help: "Description of the role.", } + roleNumber = Flag{ + Name: "Number", + LongForm: "number", + ShortForm: "n", + Help: "Number of roles, that match the search criteria, to retrieve. Maximum result number is 1000.", + } ) func rolesCmd(cli *cli) *cobra.Command { @@ -66,6 +72,10 @@ func listRolesCmd(cli *cli) *cobra.Command { auth0 roles ls --number 100 auth0 roles ls -n 100 --json`, RunE: func(cmd *cobra.Command, args []string) error { + if inputs.Number < 1 || inputs.Number > 1000 { + return fmt.Errorf("number flag invalid, please pass a number between 1 and 1000") + } + list, err := getWithPagination( cmd.Context(), inputs.Number, @@ -98,7 +108,7 @@ func listRolesCmd(cli *cli) *cobra.Command { } cmd.Flags().BoolVar(&cli.json, "json", false, "Output in json format.") - number.RegisterInt(cmd, &inputs.Number, defaultPageSize) + roleNumber.RegisterInt(cmd, &inputs.Number, defaultPageSize) return cmd } diff --git a/internal/cli/roles_permissions.go b/internal/cli/roles_permissions.go index ee8fbc576..ee330de44 100644 --- a/internal/cli/roles_permissions.go +++ b/internal/cli/roles_permissions.go @@ -8,8 +8,6 @@ import ( "github.com/auth0/go-auth0" "github.com/auth0/go-auth0/management" "github.com/spf13/cobra" - - "github.com/auth0/auth0-cli/internal/ansi" ) var ( @@ -28,6 +26,13 @@ var ( Help: "Permissions.", IsRequired: true, } + + roleAPIPermissionsNumber = Flag{ + Name: "Number", + LongForm: "number", + ShortForm: "n", + Help: "Number of permissions, that match the search criteria, to retrieve. Maximum result number is 1000.", + } ) func rolePermissionsCmd(cli *cli) *cobra.Command { @@ -48,7 +53,8 @@ func rolePermissionsCmd(cli *cli) *cobra.Command { func listRolePermissionsCmd(cli *cli) *cobra.Command { var inputs struct { - ID string + ID string + Number int } cmd := &cobra.Command{ @@ -59,8 +65,13 @@ func listRolePermissionsCmd(cli *cli) *cobra.Command { Long: "List existing permissions defined in a role. To add a permission, run: `auth0 roles permissions add`.", Example: ` auth0 roles permissions list auth0 roles permissions ls - auth0 roles permissions ls --json`, + auth0 roles permissions ls --number 100 + auth0 roles permissions ls -n 100 --json`, RunE: func(cmd *cobra.Command, args []string) error { + if inputs.Number < 1 || inputs.Number > 1000 { + return fmt.Errorf("number flag invalid, please pass a number between 1 and 1000") + } + if len(args) == 0 { err := roleID.Pick(cmd, &inputs.ID, cli.rolePickerOptions) if err != nil { @@ -70,22 +81,38 @@ func listRolePermissionsCmd(cli *cli) *cobra.Command { inputs.ID = args[0] } - var list *management.PermissionList + list, err := getWithPagination( + cmd.Context(), + inputs.Number, + func(opts ...management.RequestOption) (result []interface{}, hasNext bool, err error) { + permissionsList, err := cli.api.Role.Permissions(inputs.ID, opts...) + if err != nil { + return nil, false, err + } + + for _, role := range permissionsList.Permissions { + result = append(result, role) + } + return result, permissionsList.HasNext(), nil + }, + ) - if err := ansi.Waiting(func() error { - var err error - list, err = cli.api.Role.Permissions(inputs.ID) - return err - }); err != nil { - return fmt.Errorf("An unexpected error occurred: %w", err) + if err != nil { + return fmt.Errorf("Failed to get permissions: %w", err) + } + + var permissions []*management.Permission + for _, item := range list { + permissions = append(permissions, item.(*management.Permission)) } - cli.renderer.RolePermissionList(list.Permissions) + cli.renderer.RolePermissionList(permissions) return nil }, } cmd.Flags().BoolVar(&cli.json, "json", false, "Output in json format.") + roleAPIPermissionsNumber.RegisterInt(cmd, &inputs.Number, defaultPageSize) return cmd } From c405a2e7aeb28fe2ac61591b20db278be64a27f6 Mon Sep 17 00:00:00 2001 From: Ewan Harris Date: Tue, 17 Jan 2023 14:20:10 +0000 Subject: [PATCH 2/6] Unique help text for each orgs subcommand --- docs/auth0_orgs_members_list.md | 2 +- docs/auth0_orgs_roles_list.md | 2 +- docs/auth0_orgs_roles_members_list.md | 2 +- internal/cli/organizations.go | 6 +++++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/docs/auth0_orgs_members_list.md b/docs/auth0_orgs_members_list.md index 469c27cc3..b77a78db2 100644 --- a/docs/auth0_orgs_members_list.md +++ b/docs/auth0_orgs_members_list.md @@ -24,7 +24,7 @@ auth0 orgs members list [flags] ``` --json Output in json format. - -n, --number int Number of organizations, that match the search criteria, to retrieve. Maximum result number is 1000. (default 50) + -n, --number int Number of organization members to retrieve. Maximum result number is 1000. (default 50) ``` diff --git a/docs/auth0_orgs_roles_list.md b/docs/auth0_orgs_roles_list.md index abcc9703a..28773ae94 100644 --- a/docs/auth0_orgs_roles_list.md +++ b/docs/auth0_orgs_roles_list.md @@ -24,7 +24,7 @@ auth0 orgs roles list [flags] ``` --json Output in json format. - -n, --number int Number of organizations, that match the search criteria, to retrieve. Maximum result number is 1000. (default 50) + -n, --number int Number of organization roles to retrieve. Maximum result number is 1000. (default 50) ``` diff --git a/docs/auth0_orgs_roles_members_list.md b/docs/auth0_orgs_roles_members_list.md index 17acc4086..8edb9e4bc 100644 --- a/docs/auth0_orgs_roles_members_list.md +++ b/docs/auth0_orgs_roles_members_list.md @@ -26,7 +26,7 @@ auth0 orgs roles members list [flags] ``` --json Output in json format. - -n, --number int Number of organizations, that match the search criteria, to retrieve. Maximum result number is 1000. (default 50) + -n, --number int Number of member to retrieve. Maximum result number is 1000. (default 50) -r, --role-id string Role Identifier. ``` diff --git a/internal/cli/organizations.go b/internal/cli/organizations.go index 828884002..3704fb788 100644 --- a/internal/cli/organizations.go +++ b/internal/cli/organizations.go @@ -78,11 +78,11 @@ var ( IsRequired: true, } + // There is no Help value set here as it is set before registering each time so that we can ensure the help text is correct. organizationNumber = Flag{ Name: "Number", LongForm: "number", ShortForm: "n", - Help: "Number of organizations, that match the search criteria, to retrieve. Maximum result number is 1000.", } ) @@ -160,6 +160,7 @@ func listOrganizationsCmd(cli *cli) *cobra.Command { } cmd.Flags().BoolVar(&cli.json, "json", false, "Output in json format.") + organizationNumber.Help = "Number of organizations, that match the search criteria, to retrieve. Maximum result number is 1000." organizationNumber.RegisterInt(cmd, &inputs.Number, defaultPageSize) return cmd @@ -541,6 +542,7 @@ func listMembersOrganizationCmd(cli *cli) *cobra.Command { }, } + organizationNumber.Help = "Number of organization members to retrieve. Maximum result number is 1000." organizationNumber.RegisterInt(cmd, &inputs.Number, defaultPageSize) cmd.Flags().BoolVar(&cli.json, "json", false, "Output in json format.") cmd.SetUsageTemplate(resourceUsageTemplate()) @@ -606,6 +608,7 @@ func listRolesOrganizationCmd(cli *cli) *cobra.Command { }, } + organizationNumber.Help = "Number of organization roles to retrieve. Maximum result number is 1000." organizationNumber.RegisterInt(cmd, &inputs.Number, defaultPageSize) cmd.Flags().BoolVar(&cli.json, "json", false, "Output in json format.") @@ -683,6 +686,7 @@ func listMembersRolesOrganizationCmd(cli *cli) *cobra.Command { cmd.SetUsageTemplate(resourceUsageTemplate()) cmd.Flags().BoolVar(&cli.json, "json", false, "Output in json format.") roleIdentifier.RegisterString(cmd, &inputs.RoleID, "") + organizationNumber.Help = "Number of members to retrieve. Maximum result number is 1000." organizationNumber.RegisterInt(cmd, &inputs.Number, defaultPageSize) return cmd From 3b09f4c66cbaa6dd1787bee70c0b1d4e69a71f2a Mon Sep 17 00:00:00 2001 From: Ewan Harris Date: Tue, 17 Jan 2023 14:35:01 +0000 Subject: [PATCH 3/6] Ouput role ID in error message --- internal/cli/roles_permissions.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/cli/roles_permissions.go b/internal/cli/roles_permissions.go index ee330de44..8a42e9d55 100644 --- a/internal/cli/roles_permissions.go +++ b/internal/cli/roles_permissions.go @@ -98,7 +98,7 @@ func listRolePermissionsCmd(cli *cli) *cobra.Command { ) if err != nil { - return fmt.Errorf("Failed to get permissions: %w", err) + return fmt.Errorf("Failed to get permissions for role '%s': %w", inputs.ID, err) } var permissions []*management.Permission From d8c07f88597419f779b354ed158439265d41613a Mon Sep 17 00:00:00 2001 From: Ewan Harris Date: Tue, 17 Jan 2023 14:58:33 +0000 Subject: [PATCH 4/6] Rework help text for number flag --- docs/auth0_apis_list.md | 2 +- docs/auth0_apps_list.md | 2 +- docs/auth0_orgs_list.md | 2 +- docs/auth0_orgs_members_list.md | 2 +- docs/auth0_orgs_roles_list.md | 2 +- docs/auth0_orgs_roles_members_list.md | 2 +- docs/auth0_roles_list.md | 2 +- docs/auth0_roles_permissions_list.md | 2 +- docs/auth0_users_search.md | 2 +- internal/cli/apis.go | 2 +- internal/cli/apps.go | 2 +- internal/cli/organizations.go | 8 ++++---- internal/cli/roles.go | 2 +- internal/cli/roles_permissions.go | 2 +- internal/cli/users.go | 2 +- 15 files changed, 18 insertions(+), 18 deletions(-) diff --git a/docs/auth0_apis_list.md b/docs/auth0_apis_list.md index a3de16fdd..aedec1fe4 100644 --- a/docs/auth0_apis_list.md +++ b/docs/auth0_apis_list.md @@ -24,7 +24,7 @@ auth0 apis list [flags] ``` --json Output in json format. - -n, --number int Number of APIs, that match the search criteria, to retrieve. Maximum result number is 1000. (default 50) + -n, --number int Number of APIs to retrieve. Minimum 1, maximum 1000. (default 50) ``` diff --git a/docs/auth0_apps_list.md b/docs/auth0_apps_list.md index c86e004ca..e8bacaa6d 100644 --- a/docs/auth0_apps_list.md +++ b/docs/auth0_apps_list.md @@ -25,7 +25,7 @@ auth0 apps list [flags] ``` --json Output in json format. - -n, --number int Number of apps, that match the search criteria, to retrieve. Maximum result number is 1000. (default 50) + -n, --number int Number of apps to retrieve. Minimum 1, maximum 1000. (default 50) -r, --reveal-secrets Display the application secrets ('signing_keys', 'client_secret') as part of the command output. ``` diff --git a/docs/auth0_orgs_list.md b/docs/auth0_orgs_list.md index c8bbb0c95..62ddf1c94 100644 --- a/docs/auth0_orgs_list.md +++ b/docs/auth0_orgs_list.md @@ -24,7 +24,7 @@ auth0 orgs list [flags] ``` --json Output in json format. - -n, --number int Number of organizations, that match the search criteria, to retrieve. Maximum result number is 1000. (default 50) + -n, --number int Number of organizations to retrieve. Minimum 1, maximum 1000. (default 50) ``` diff --git a/docs/auth0_orgs_members_list.md b/docs/auth0_orgs_members_list.md index b77a78db2..a179c625e 100644 --- a/docs/auth0_orgs_members_list.md +++ b/docs/auth0_orgs_members_list.md @@ -24,7 +24,7 @@ auth0 orgs members list [flags] ``` --json Output in json format. - -n, --number int Number of organization members to retrieve. Maximum result number is 1000. (default 50) + -n, --number int Number of organization members to retrieve. Minimum 1, maximum 1000. (default 50) ``` diff --git a/docs/auth0_orgs_roles_list.md b/docs/auth0_orgs_roles_list.md index 28773ae94..f4eced8c9 100644 --- a/docs/auth0_orgs_roles_list.md +++ b/docs/auth0_orgs_roles_list.md @@ -24,7 +24,7 @@ auth0 orgs roles list [flags] ``` --json Output in json format. - -n, --number int Number of organization roles to retrieve. Maximum result number is 1000. (default 50) + -n, --number int Number of organization roles to retrieve. Minimum 1, maximum 1000. (default 50) ``` diff --git a/docs/auth0_orgs_roles_members_list.md b/docs/auth0_orgs_roles_members_list.md index 8edb9e4bc..3293f414e 100644 --- a/docs/auth0_orgs_roles_members_list.md +++ b/docs/auth0_orgs_roles_members_list.md @@ -26,7 +26,7 @@ auth0 orgs roles members list [flags] ``` --json Output in json format. - -n, --number int Number of member to retrieve. Maximum result number is 1000. (default 50) + -n, --number int Number of members to retrieve. Minimum 1, maximum 1000. (default 50) -r, --role-id string Role Identifier. ``` diff --git a/docs/auth0_roles_list.md b/docs/auth0_roles_list.md index 4fcade6e6..fd85db8d7 100644 --- a/docs/auth0_roles_list.md +++ b/docs/auth0_roles_list.md @@ -24,7 +24,7 @@ auth0 roles list [flags] ``` --json Output in json format. - -n, --number int Number of roles, that match the search criteria, to retrieve. Maximum result number is 1000. (default 50) + -n, --number int Number of roles to retrieve. Minimum 1, maximum 1000. (default 50) ``` diff --git a/docs/auth0_roles_permissions_list.md b/docs/auth0_roles_permissions_list.md index 7de14993f..e7c1ada00 100644 --- a/docs/auth0_roles_permissions_list.md +++ b/docs/auth0_roles_permissions_list.md @@ -24,7 +24,7 @@ auth0 roles permissions list [flags] ``` --json Output in json format. - -n, --number int Number of permissions, that match the search criteria, to retrieve. Maximum result number is 1000. (default 50) + -n, --number int Number of permissions to retrieve. Minimum 1, maximum 1000. (default 50) ``` diff --git a/docs/auth0_users_search.md b/docs/auth0_users_search.md index 5e2db2ba9..feecd2a76 100644 --- a/docs/auth0_users_search.md +++ b/docs/auth0_users_search.md @@ -25,7 +25,7 @@ auth0 users search [flags] ``` --json Output in json format. - -n, --number int Number of users, that match the search criteria, to retrieve. Maximum result number is 1000. If limit is hit, please refine the search query. (default 50) + -n, --number int Number of users to retrieve. Minimum 1, maximum 1000. (default 50) -q, --query string Query in Lucene query syntax. See https://auth0.com/docs/users/user-search/user-search-query-syntax for more details. -s, --sort string Field to sort by. Use 'field:order' where 'order' is '1' for ascending and '-1' for descending. e.g. 'created_at:1'. ``` diff --git a/internal/cli/apis.go b/internal/cli/apis.go index 0924f7727..82303e5ad 100644 --- a/internal/cli/apis.go +++ b/internal/cli/apis.go @@ -58,7 +58,7 @@ var ( Name: "Number", LongForm: "number", ShortForm: "n", - Help: "Number of APIs, that match the search criteria, to retrieve. Maximum result number is 1000.", + Help: "Number of APIs to retrieve. Minimum 1, maximum 1000.", } ) diff --git a/internal/cli/apps.go b/internal/cli/apps.go index e9fe02527..dbb114854 100644 --- a/internal/cli/apps.go +++ b/internal/cli/apps.go @@ -123,7 +123,7 @@ var ( Name: "Number", LongForm: "number", ShortForm: "n", - Help: "Number of apps, that match the search criteria, to retrieve. Maximum result number is 1000.", + Help: "Number of apps to retrieve. Minimum 1, maximum 1000.", } ) diff --git a/internal/cli/organizations.go b/internal/cli/organizations.go index 3704fb788..636162b1e 100644 --- a/internal/cli/organizations.go +++ b/internal/cli/organizations.go @@ -160,7 +160,7 @@ func listOrganizationsCmd(cli *cli) *cobra.Command { } cmd.Flags().BoolVar(&cli.json, "json", false, "Output in json format.") - organizationNumber.Help = "Number of organizations, that match the search criteria, to retrieve. Maximum result number is 1000." + organizationNumber.Help = "Number of organizations to retrieve. Minimum 1, maximum 1000." organizationNumber.RegisterInt(cmd, &inputs.Number, defaultPageSize) return cmd @@ -542,7 +542,7 @@ func listMembersOrganizationCmd(cli *cli) *cobra.Command { }, } - organizationNumber.Help = "Number of organization members to retrieve. Maximum result number is 1000." + organizationNumber.Help = "Number of organization members to retrieve. Minimum 1, maximum 1000." organizationNumber.RegisterInt(cmd, &inputs.Number, defaultPageSize) cmd.Flags().BoolVar(&cli.json, "json", false, "Output in json format.") cmd.SetUsageTemplate(resourceUsageTemplate()) @@ -608,7 +608,7 @@ func listRolesOrganizationCmd(cli *cli) *cobra.Command { }, } - organizationNumber.Help = "Number of organization roles to retrieve. Maximum result number is 1000." + organizationNumber.Help = "Number of organization roles to retrieve. Minimum 1, maximum 1000." organizationNumber.RegisterInt(cmd, &inputs.Number, defaultPageSize) cmd.Flags().BoolVar(&cli.json, "json", false, "Output in json format.") @@ -686,7 +686,7 @@ func listMembersRolesOrganizationCmd(cli *cli) *cobra.Command { cmd.SetUsageTemplate(resourceUsageTemplate()) cmd.Flags().BoolVar(&cli.json, "json", false, "Output in json format.") roleIdentifier.RegisterString(cmd, &inputs.RoleID, "") - organizationNumber.Help = "Number of members to retrieve. Maximum result number is 1000." + organizationNumber.Help = "Number of members to retrieve. Minimum 1, maximum 1000." organizationNumber.RegisterInt(cmd, &inputs.Number, defaultPageSize) return cmd diff --git a/internal/cli/roles.go b/internal/cli/roles.go index 3e87a3ee1..ef784993b 100644 --- a/internal/cli/roles.go +++ b/internal/cli/roles.go @@ -33,7 +33,7 @@ var ( Name: "Number", LongForm: "number", ShortForm: "n", - Help: "Number of roles, that match the search criteria, to retrieve. Maximum result number is 1000.", + Help: "Number of roles to retrieve. Minimum 1, maximum 1000.", } ) diff --git a/internal/cli/roles_permissions.go b/internal/cli/roles_permissions.go index 8a42e9d55..5dd603f13 100644 --- a/internal/cli/roles_permissions.go +++ b/internal/cli/roles_permissions.go @@ -31,7 +31,7 @@ var ( Name: "Number", LongForm: "number", ShortForm: "n", - Help: "Number of permissions, that match the search criteria, to retrieve. Maximum result number is 1000.", + Help: "Number of permissions to retrieve. Minimum 1, maximum 1000.", } ) diff --git a/internal/cli/users.go b/internal/cli/users.go index 4b72a569d..ecb05e8dd 100644 --- a/internal/cli/users.go +++ b/internal/cli/users.go @@ -72,7 +72,7 @@ var ( Name: "Number", LongForm: "number", ShortForm: "n", - Help: "Number of users, that match the search criteria, to retrieve. Maximum result number is 1000. If limit is hit, please refine the search query.", + Help: "Number of users to retrieve. Minimum 1, maximum 1000.", } userImportTemplate = Flag{ Name: "Template", From 7854f8ad892646613cba734250d58f2af7c742b9 Mon Sep 17 00:00:00 2001 From: Ewan Harris Date: Tue, 17 Jan 2023 15:06:25 +0000 Subject: [PATCH 5/6] Add back search refinement to users search Co-authored-by: Sergiu Ghitea <28300158+sergiught@users.noreply.github.com> --- docs/auth0_users_search.md | 2 +- internal/cli/users.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/auth0_users_search.md b/docs/auth0_users_search.md index feecd2a76..b407daa2f 100644 --- a/docs/auth0_users_search.md +++ b/docs/auth0_users_search.md @@ -25,7 +25,7 @@ auth0 users search [flags] ``` --json Output in json format. - -n, --number int Number of users to retrieve. Minimum 1, maximum 1000. (default 50) + -n, --number int Number of users, that match the search criteria, to retrieve. Minimum 1, maximum 1000. If limit is hit, refine the search query. (default 50) -q, --query string Query in Lucene query syntax. See https://auth0.com/docs/users/user-search/user-search-query-syntax for more details. -s, --sort string Field to sort by. Use 'field:order' where 'order' is '1' for ascending and '-1' for descending. e.g. 'created_at:1'. ``` diff --git a/internal/cli/users.go b/internal/cli/users.go index ecb05e8dd..968d6676d 100644 --- a/internal/cli/users.go +++ b/internal/cli/users.go @@ -72,7 +72,7 @@ var ( Name: "Number", LongForm: "number", ShortForm: "n", - Help: "Number of users to retrieve. Minimum 1, maximum 1000.", + Help: "Number of users, that match the search criteria, to retrieve. Minimum 1, maximum 1000. If limit is hit, refine the search query.", } userImportTemplate = Flag{ Name: "Template", From 267523eb3aeafdf41c863687854723222ccadb3d Mon Sep 17 00:00:00 2001 From: Sergiu Ghitea <28300158+sergiught@users.noreply.github.com> Date: Tue, 17 Jan 2023 17:37:24 +0100 Subject: [PATCH 6/6] Update internal/cli/organizations.go --- internal/cli/organizations.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/cli/organizations.go b/internal/cli/organizations.go index 636162b1e..57bb2a2b0 100644 --- a/internal/cli/organizations.go +++ b/internal/cli/organizations.go @@ -78,7 +78,7 @@ var ( IsRequired: true, } - // There is no Help value set here as it is set before registering each time so that we can ensure the help text is correct. + // Purposefully not setting the Help value on the Flag because overridden where appropriate. organizationNumber = Flag{ Name: "Number", LongForm: "number",