Skip to content

Commit 8ca147d

Browse files
author
Michael Christenson II
authored
Add csv format to table views (#955)
* Add csv format to table views Adds csv as a general format cli wide for all table viewable commands
1 parent 12ca7e5 commit 8ca147d

39 files changed

+204
-39
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ tags
3030
.DS_Store
3131
.idea
3232
.env
33+
.envrc
3334

3435
# Vendor
3536
vendor

docs/auth0_actions_list.md

+2
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@ auth0 actions list [flags]
1818
auth0 actions list
1919
auth0 actions ls
2020
auth0 actions ls --json
21+
auth0 actions ls --csv
2122
```
2223

2324

2425
## Flags
2526

2627
```
28+
--csv Output in csv format.
2729
--json Output in json format.
2830
```
2931

docs/auth0_apis_list.md

+2
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@ auth0 apis list [flags]
1919
auth0 apis ls
2020
auth0 apis ls --number 100
2121
auth0 apis ls -n 100 --json
22+
auth0 apis ls --csv
2223
```
2324

2425

2526
## Flags
2627

2728
```
29+
--csv Output in csv format.
2830
--json Output in json format.
2931
-n, --number int Number of APIs to retrieve. Minimum 1, maximum 1000. (default 100)
3032
```

docs/auth0_apis_scopes_list.md

+2
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@ auth0 apis scopes list [flags]
1818
auth0 apis scopes list
1919
auth0 apis scopes ls <api-id|api-audience>
2020
auth0 apis scopes ls <api-id|api-audience> --json
21+
auth0 apis scopes ls <api-id|api-audience> --csv
2122
```
2223

2324

2425
## Flags
2526

2627
```
28+
--csv Output in csv format.
2729
--json Output in json format.
2830
```
2931

docs/auth0_apps_list.md

+2
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,14 @@ auth0 apps list [flags]
2020
auth0 apps list --reveal-secrets
2121
auth0 apps list --reveal-secrets --number 100
2222
auth0 apps ls -r -n 100 --json
23+
auth0 apps ls --csv
2324
```
2425

2526

2627
## Flags
2728

2829
```
30+
--csv Output in csv format.
2931
--json Output in json format.
3032
-n, --number int Number of apps to retrieve. Minimum 1, maximum 1000. (default 100)
3133
-r, --reveal-secrets Display the application secrets ('signing_keys', 'client_secret') as part of the command output.

docs/auth0_domains_list.md

+2
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@ auth0 domains list [flags]
1818
auth0 domains list
1919
auth0 domains ls
2020
auth0 domains ls --json
21+
auth0 domains ls --csv
2122
```
2223

2324

2425
## Flags
2526

2627
```
28+
--csv Output in csv format.
2729
--json Output in json format.
2830
```
2931

docs/auth0_logs_list.md

+3
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,15 @@ auth0 logs list [flags]
2323
auth0 logs list --filter "ip:<ip>"
2424
auth0 logs list --filter "type:f" # See the full list of type codes at https://auth0.com/docs/logs/log-event-type-codes
2525
auth0 logs ls -n 250
26+
auth0 logs ls --json
27+
auth0 logs ls --csv
2628
```
2729

2830

2931
## Flags
3032

3133
```
34+
--csv Output in csv format.
3235
-f, --filter string Filter in Lucene query syntax. See https://auth0.com/docs/logs/log-search-query-syntax for more details.
3336
--json Output in json format.
3437
-n, --number int Number of log entries to show. Minimum 1, maximum 1000. (default 100)

docs/auth0_logs_streams_list.md

+2
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@ auth0 logs streams list [flags]
1818
auth0 logs streams list
1919
auth0 logs streams ls
2020
auth0 logs streams ls --json
21+
auth0 logs streams ls --csv
2122
```
2223

2324

2425
## Flags
2526

2627
```
28+
--csv Output in csv format.
2729
--json Output in json format.
2830
```
2931

docs/auth0_orgs_list.md

+2
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,15 @@ auth0 orgs list [flags]
1818
auth0 orgs list
1919
auth0 orgs ls
2020
auth0 orgs ls --json
21+
auth0 orgs ls --csv
2122
auth0 orgs ls -n 100
2223
```
2324

2425

2526
## Flags
2627

2728
```
29+
--csv Output in csv format.
2830
--json Output in json format.
2931
-n, --number int Number of organizations to retrieve. Minimum 1, maximum 1000. (default 100)
3032
```

docs/auth0_orgs_members_list.md

+2
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@ auth0 orgs members list [flags]
1919
auth0 orgs members ls <org-id>
2020
auth0 orgs members list <org-id> --number 100
2121
auth0 orgs members ls <org-id> -n 100 --json
22+
auth0 orgs members ls <org-id> --csv
2223
```
2324

2425

2526
## Flags
2627

2728
```
29+
--csv Output in csv format.
2830
--json Output in json format.
2931
-n, --number int Number of organization members to retrieve. Minimum 1, maximum 1000. (default 100)
3032
```

docs/auth0_orgs_roles_list.md

+2
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@ auth0 orgs roles list [flags]
1919
auth0 orgs roles ls <org-id>
2020
auth0 orgs roles list <org-id> --number 100
2121
auth0 orgs roles ls <org-id> -n 100 --json
22+
auth0 orgs roles ls <org-id> --csv
2223
```
2324

2425

2526
## Flags
2627

2728
```
29+
--csv Output in csv format.
2830
--json Output in json format.
2931
-n, --number int Number of organization roles to retrieve. Minimum 1, maximum 1000. (default 100)
3032
```

docs/auth0_orgs_roles_members_list.md

+2
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,14 @@ auth0 orgs roles members list [flags]
2121
auth0 orgs roles members list <org-id> --role-id role --number 100
2222
auth0 orgs roles members ls <org-id> -r role -n 100
2323
auth0 orgs roles members ls <org-id> -r role -n 100 --json
24+
auth0 orgs roles members ls <org-id> --csv
2425
```
2526

2627

2728
## Flags
2829

2930
```
31+
--csv Output in csv format.
3032
--json Output in json format.
3133
-n, --number int Number of members to retrieve. Minimum 1, maximum 1000. (default 100)
3234
-r, --role-id string Role Identifier.

docs/auth0_quickstarts_list.md

+2
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,14 @@ auth0 quickstarts list [flags]
2020
auth0 qs list
2121
auth0 qs ls
2222
auth0 qs ls --json
23+
auth0 qs ls --csv
2324
```
2425

2526

2627
## Flags
2728

2829
```
30+
--csv Output in csv format.
2931
--json Output in json format.
3032
```
3133

docs/auth0_roles_list.md

+2
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@ auth0 roles list [flags]
1919
auth0 roles ls
2020
auth0 roles ls --number 100
2121
auth0 roles ls -n 100 --json
22+
auth0 roles ls --csv
2223
```
2324

2425

2526
## Flags
2627

2728
```
29+
--csv Output in csv format.
2830
--json Output in json format.
2931
-n, --number int Number of roles to retrieve. Minimum 1, maximum 1000. (default 100)
3032
```

docs/auth0_roles_permissions_list.md

+2
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@ auth0 roles permissions list [flags]
1919
auth0 roles permissions ls <role-id>
2020
auth0 roles permissions ls <role-id> --number 100
2121
auth0 roles permissions ls <role-id> -n 100 --json
22+
auth0 roles permissions ls <role-id> --csv
2223
```
2324

2425

2526
## Flags
2627

2728
```
29+
--csv Output in csv format.
2830
--json Output in json format.
2931
-n, --number int Number of permissions to retrieve. Minimum 1, maximum 1000. (default 100)
3032
```

docs/auth0_rules_list.md

+2
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,14 @@ auth0 rules list [flags]
2020
auth0 rules list
2121
auth0 rules ls
2222
auth0 rules ls --json
23+
auth0 rules ls --csv
2324
```
2425

2526

2627
## Flags
2728

2829
```
30+
--csv Output in csv format.
2931
--json Output in json format.
3032
```
3133

docs/auth0_tenants_list.md

+8
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,17 @@ auth0 tenants list [flags]
1717
```
1818
auth0 tenants list
1919
auth0 tenants ls
20+
auth0 tenants ls --json
21+
auth0 tenants ls --csv
2022
```
2123

2224

25+
## Flags
26+
27+
```
28+
--csv Output in csv format.
29+
--json Output in json format.
30+
```
2331

2432

2533
## Inherited Flags

docs/auth0_users_blocks_list.md

+2
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@ auth0 users blocks list [flags]
1919
auth0 users blocks list <user-id|username|email|phone-number> --json
2020
auth0 users blocks list "auth0|61b5b6e90783fa19f7c57dad"
2121
auth0 users blocks list "[email protected]"
22+
auth0 users blocks list <user-id|username|email|phone-number> --csv
2223
```
2324

2425

2526
## Flags
2627

2728
```
29+
--csv Output in csv format.
2830
--json Output in json format.
2931
```
3032

docs/auth0_users_roles_show.md

+2
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@ auth0 users roles show [flags]
1919
auth0 users roles show <user-id>
2020
auth0 users roles show <user-id> --number 100
2121
auth0 users roles show <user-id> -n 100 --json
22+
auth0 users roles show <user-id> --csv
2223
```
2324

2425

2526
## Flags
2627

2728
```
29+
--csv Output in csv format.
2830
--json Output in json format.
2931
-n, --number int Number of user roles to retrieve. Minimum 1, maximum 1000. (default 100)
3032
```

docs/auth0_users_search.md

+2
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,14 @@ auth0 users search [flags]
2020
auth0 users search --query name:"Bob" --sort "name:1"
2121
auth0 users search -q name:"Bob" -s "name:1" --number 200
2222
auth0 users search -q name:"Bob" -s "name:1" -n 200 --json
23+
auth0 users search -q name:"Bob" -s "name:1" -n 200 --csv
2324
```
2425

2526

2627
## Flags
2728

2829
```
30+
--csv Output in csv format.
2931
--json Output in json format.
3032
-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 100)
3133
-q, --query email:"user123@*.com" OR (user_id:"user-id-123" AND name:"Bob") Search query in Lucene query syntax.

internal/cli/actions.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ func listActionsCmd(cli *cli) *cobra.Command {
9898
Long: "List your existing actions. To create one, run: `auth0 actions create`.",
9999
Example: ` auth0 actions list
100100
auth0 actions ls
101-
auth0 actions ls --json`,
101+
auth0 actions ls --json
102+
auth0 actions ls --csv`,
102103
RunE: func(cmd *cobra.Command, args []string) error {
103104
var list *management.ActionList
104105

@@ -116,6 +117,8 @@ func listActionsCmd(cli *cli) *cobra.Command {
116117
}
117118

118119
cmd.Flags().BoolVar(&cli.json, "json", false, "Output in json format.")
120+
cmd.Flags().BoolVar(&cli.csv, "csv", false, "Output in csv format.")
121+
cmd.MarkFlagsMutuallyExclusive("json", "csv")
119122

120123
return cmd
121124
}

internal/cli/apis.go

+9-2
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,8 @@ func listApisCmd(cli *cli) *cobra.Command {
119119
Example: ` auth0 apis list
120120
auth0 apis ls
121121
auth0 apis ls --number 100
122-
auth0 apis ls -n 100 --json`,
122+
auth0 apis ls -n 100 --json
123+
auth0 apis ls --csv`,
123124
RunE: func(cmd *cobra.Command, args []string) error {
124125
if inputs.Number < 1 || inputs.Number > 1000 {
125126
return fmt.Errorf("number flag invalid, please pass a number between 1 and 1000")
@@ -156,6 +157,9 @@ func listApisCmd(cli *cli) *cobra.Command {
156157
}
157158

158159
cmd.Flags().BoolVar(&cli.json, "json", false, "Output in json format.")
160+
cmd.Flags().BoolVar(&cli.csv, "csv", false, "Output in csv format.")
161+
cmd.MarkFlagsMutuallyExclusive("json", "csv")
162+
159163
apiNumber.RegisterInt(cmd, &inputs.Number, defaultPageSize)
160164

161165
return cmd
@@ -528,7 +532,8 @@ func listScopesCmd(cli *cli) *cobra.Command {
528532
Long: "List the scopes of an API. To update scopes, run: `auth0 apis update <id|audience> -s <scopes>`.",
529533
Example: ` auth0 apis scopes list
530534
auth0 apis scopes ls <api-id|api-audience>
531-
auth0 apis scopes ls <api-id|api-audience> --json`,
535+
auth0 apis scopes ls <api-id|api-audience> --json
536+
auth0 apis scopes ls <api-id|api-audience> --csv`,
532537
RunE: func(cmd *cobra.Command, args []string) error {
533538
if len(args) == 0 {
534539
err := apiID.Pick(cmd, &inputs.ID, cli.apiPickerOptions)
@@ -556,6 +561,8 @@ func listScopesCmd(cli *cli) *cobra.Command {
556561
}
557562

558563
cmd.Flags().BoolVar(&cli.json, "json", false, "Output in json format.")
564+
cmd.Flags().BoolVar(&cli.csv, "csv", false, "Output in csv format.")
565+
cmd.MarkFlagsMutuallyExclusive("json", "csv")
559566

560567
return cmd
561568
}

internal/cli/apps.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,8 @@ func listAppsCmd(cli *cli) *cobra.Command {
222222
auth0 apps ls
223223
auth0 apps list --reveal-secrets
224224
auth0 apps list --reveal-secrets --number 100
225-
auth0 apps ls -r -n 100 --json`,
225+
auth0 apps ls -r -n 100 --json
226+
auth0 apps ls --csv`,
226227
RunE: func(cmd *cobra.Command, args []string) error {
227228
if inputs.Number < 1 || inputs.Number > 1000 {
228229
return fmt.Errorf("number flag invalid, please pass a number between 1 and 1000")
@@ -258,6 +259,9 @@ func listAppsCmd(cli *cli) *cobra.Command {
258259
}
259260

260261
cmd.Flags().BoolVar(&cli.json, "json", false, "Output in json format.")
262+
cmd.Flags().BoolVar(&cli.csv, "csv", false, "Output in csv format.")
263+
cmd.MarkFlagsMutuallyExclusive("json", "csv")
264+
261265
revealSecrets.RegisterBool(cmd, &inputs.RevealSecrets, false)
262266
appNumber.RegisterInt(cmd, &inputs.Number, defaultPageSize)
263267

0 commit comments

Comments
 (0)