Skip to content

Commit 9ed850a

Browse files
authored
Merge branch 'main' into dependabot/go_modules/github.com/auth0/go-auth0-1.32.0
2 parents d4e7851 + 83e9849 commit 9ed850a

20 files changed

+183
-41
lines changed

docs/auth0_roles_permissions_add.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,16 @@ auth0 roles permissions add [flags]
2020
auth0 roles permissions add <role-id> --api-id <api-id>
2121
auth0 roles permissions add <role-id> --api-id <api-id> --permissions <permission-name>
2222
auth0 roles permissions add <role-id> -a <api-id> -p <permission-name>
23+
auth0 roles permissions add <role-id> --resource-server-identifier <api-id> --permissions <permission-name>
2324
```
2425

2526

2627
## Flags
2728

2829
```
29-
-a, --api-id string API Identifier.
30-
-p, --permissions strings Permissions.
30+
-a, --api-id string API Identifier.
31+
-p, --permissions strings Permissions.
32+
--resource-server-identifier string API Identifier.
3133
```
3234

3335

docs/auth0_roles_permissions_remove.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,16 @@ auth0 roles permissions remove [flags]
1919
auth0 roles permissions rm <role-id> --api-id <api-id>
2020
auth0 roles permissions rm <role-id> --api-id <api-id> --permissions <permission-name>
2121
auth0 roles permissions rm <role-id> -a <api-id> -p <permission-name>
22+
auth0 roles permissions rm <role-id> --resource-server-identifier <api-id> --permissions <permission-name>
2223
```
2324

2425

2526
## Flags
2627

2728
```
28-
-a, --api-id string API Identifier.
29-
-p, --permissions strings Permissions.
29+
-a, --api-id string API Identifier.
30+
-p, --permissions strings Permissions.
31+
--resource-server-identifier string API Identifier.
3032
```
3133

3234

go.mod

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ require (
1111
github.com/charmbracelet/glamour v0.10.0
1212
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e
1313
github.com/fsnotify/fsnotify v1.9.0
14-
github.com/getsentry/sentry-go v0.38.0
14+
github.com/getsentry/sentry-go v0.40.0
1515
github.com/golang/mock v1.6.0
1616
github.com/google/go-cmp v0.7.0
1717
github.com/google/uuid v1.6.0
1818
github.com/gorilla/websocket v1.5.3
19-
github.com/hashicorp/go-version v1.7.0
19+
github.com/hashicorp/go-version v1.8.0
2020
github.com/hashicorp/hc-install v0.9.2
2121
github.com/hashicorp/terraform-exec v0.24.0
2222
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
@@ -31,12 +31,11 @@ require (
3131
github.com/pkg/errors v0.9.1
3232
github.com/pmezard/go-difflib v1.0.0
3333
github.com/schollz/progressbar/v3 v3.17.1
34-
github.com/spf13/cobra v1.10.1
34+
github.com/spf13/cobra v1.10.2
3535
github.com/spf13/pflag v1.0.10
3636
github.com/stretchr/testify v1.11.1
3737
github.com/tidwall/pretty v1.2.1
3838
github.com/zalando/go-keyring v0.2.6
39-
golang.org/x/net v0.46.0
4039
golang.org/x/oauth2 v0.33.0
4140
golang.org/x/sync v0.18.0
4241
golang.org/x/sys v0.38.0
@@ -96,9 +95,10 @@ require (
9695
github.com/yuin/goldmark v1.7.8 // indirect
9796
github.com/yuin/goldmark-emoji v1.0.5 // indirect
9897
github.com/zclconf/go-cty v1.16.4 // indirect
99-
golang.org/x/crypto v0.43.0 // indirect
98+
golang.org/x/crypto v0.45.0 // indirect
10099
golang.org/x/exp v0.0.0-20230321023759-10a507213a29 // indirect
101100
golang.org/x/mod v0.29.0 // indirect
101+
golang.org/x/net v0.47.0 // indirect
102102
golang.org/x/tools v0.38.0 // indirect
103103
gopkg.in/yaml.v3 v3.0.1 // indirect
104104
)

go.sum

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM=
8484
github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE=
8585
github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k=
8686
github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=
87-
github.com/getsentry/sentry-go v0.38.0 h1:S8Xui7gLeAvXINVLMOaX94HnsDf1GexnfXGSNC4+KQs=
88-
github.com/getsentry/sentry-go v0.38.0/go.mod h1:eRXCoh3uvmjQLY6qu63BjUZnaBu5L5WhMV1RwYO8W5s=
87+
github.com/getsentry/sentry-go v0.40.0 h1:VTJMN9zbTvqDqPwheRVLcp0qcUcM+8eFivvGocAaSbo=
88+
github.com/getsentry/sentry-go v0.40.0/go.mod h1:eRXCoh3uvmjQLY6qu63BjUZnaBu5L5WhMV1RwYO8W5s=
8989
github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA=
9090
github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og=
9191
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI=
@@ -118,8 +118,8 @@ github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB1
118118
github.com/hashicorp/go-hclog v1.6.3/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M=
119119
github.com/hashicorp/go-retryablehttp v0.7.7 h1:C8hUCYzor8PIfXHa4UrZkU4VvK8o9ISHxT2Q8+VepXU=
120120
github.com/hashicorp/go-retryablehttp v0.7.7/go.mod h1:pkQpWZeYWskR+D1tR2O5OcBFOxfA7DoAO6xtkuQnHTk=
121-
github.com/hashicorp/go-version v1.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKeRZfjY=
122-
github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
121+
github.com/hashicorp/go-version v1.8.0 h1:KAkNb1HAiZd1ukkxDFGmokVZe1Xy9HG6NUp+bPle2i4=
122+
github.com/hashicorp/go-version v1.8.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
123123
github.com/hashicorp/hc-install v0.9.2 h1:v80EtNX4fCVHqzL9Lg/2xkp62bbvQMnvPQ0G+OmtO24=
124124
github.com/hashicorp/hc-install v0.9.2/go.mod h1:XUqBQNnuT4RsxoxiM9ZaUk0NX8hi2h+Lb6/c0OZnC/I=
125125
github.com/hashicorp/terraform-exec v0.24.0 h1:mL0xlk9H5g2bn0pPF6JQZk5YlByqSqrO5VoaNtAf8OE=
@@ -223,8 +223,8 @@ github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN
223223
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4=
224224
github.com/skeema/knownhosts v1.3.1 h1:X2osQ+RAjK76shCbvhHHHVl3ZlgDm8apHEHFqRjnBY8=
225225
github.com/skeema/knownhosts v1.3.1/go.mod h1:r7KTdC8l4uxWRyK2TpQZ/1o5HaSzh06ePQNxPwTcfiY=
226-
github.com/spf13/cobra v1.10.1 h1:lJeBwCfmrnXthfAupyUTzJ/J4Nc1RsHC/mSRU2dll/s=
227-
github.com/spf13/cobra v1.10.1/go.mod h1:7SmJGaTHFVBY0jW4NXGluQoLvhqFQM+6XSKD+P4XaB0=
226+
github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU=
227+
github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4=
228228
github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
229229
github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk=
230230
github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
@@ -257,11 +257,12 @@ github.com/zclconf/go-cty v1.16.4 h1:QGXaag7/7dCzb+odlGrgr+YmYZFaOCMW6DEpS+UD1eE
257257
github.com/zclconf/go-cty v1.16.4/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE=
258258
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
259259
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
260+
go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
260261
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
261262
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
262263
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
263-
golang.org/x/crypto v0.43.0 h1:dduJYIi3A3KOfdGOHX8AVZ/jGiyPa3IbBozJ5kNuE04=
264-
golang.org/x/crypto v0.43.0/go.mod h1:BFbav4mRNlXJL4wNeejLpWxB7wMbc79PdRGhWKncxR0=
264+
golang.org/x/crypto v0.45.0 h1:jMBrvKuj23MTlT0bQEOBcAE0mjg8mK9RXFhRH6nyF3Q=
265+
golang.org/x/crypto v0.45.0/go.mod h1:XTGrrkGJve7CYK7J8PEww4aY7gM3qMCElcJQ8n8JdX4=
265266
golang.org/x/exp v0.0.0-20230321023759-10a507213a29 h1:ooxPy7fPvB4kwsA2h+iBNHkAbp/4JxTSwCmvdjEYmug=
266267
golang.org/x/exp v0.0.0-20230321023759-10a507213a29/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
267268
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
@@ -274,8 +275,8 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v
274275
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
275276
golang.org/x/net v0.0.0-20210510120150-4163338589ed/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
276277
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
277-
golang.org/x/net v0.46.0 h1:giFlY12I07fugqwPuWJi68oOnpfqFnJIJzaIIm2JVV4=
278-
golang.org/x/net v0.46.0/go.mod h1:Q9BGdFy1y4nkUwiLvT5qtyhAnEHgnQ/zd8PfU6nc210=
278+
golang.org/x/net v0.47.0 h1:Mx+4dIFzqraBXUugkia1OOvlD6LemFo1ALMHjrXDOhY=
279+
golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU=
279280
golang.org/x/oauth2 v0.33.0 h1:4Q+qn+E5z8gPRJfmRy7C2gGG3T4jIprK6aSYgTXGRpo=
280281
golang.org/x/oauth2 v0.33.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA=
281282
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=

internal/cli/actions.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package cli
22

33
import (
4+
"context"
45
"errors"
56
"fmt"
67
"net/url"
@@ -10,7 +11,6 @@ import (
1011
"github.com/auth0/go-auth0/management"
1112
"github.com/pmezard/go-difflib/difflib"
1213
"github.com/spf13/cobra"
13-
"golang.org/x/net/context"
1414

1515
"github.com/auth0/auth0-cli/internal/ansi"
1616
"github.com/auth0/auth0-cli/internal/prompt"

internal/cli/apps.go

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -513,8 +513,24 @@ func createAppCmd(cli *cli) *cobra.Command {
513513

514514
// Prompt for resource server identifier if app type is resource_server.
515515
if appIsResourceServer {
516-
if err := appResourceServerIdentifier.Ask(cmd, &inputs.ResourceServerIdentifier, nil); err != nil {
517-
return err
516+
if !appResourceServerIdentifier.IsSet(cmd) {
517+
var selectedAPIID string
518+
if err := appResourceServerIdentifier.Pick(cmd, &selectedAPIID, cli.apiPickerOptionsWithoutAuth0); err != nil {
519+
return err
520+
}
521+
522+
var selectedAPI *management.ResourceServer
523+
if err := ansi.Waiting(func() error {
524+
var err error
525+
selectedAPI, err = cli.api.ResourceServer.Read(cmd.Context(), selectedAPIID)
526+
return err
527+
}); err != nil {
528+
return fmt.Errorf("failed to read selected API: %w", err)
529+
}
530+
531+
inputs.ResourceServerIdentifier = selectedAPI.GetIdentifier()
532+
} else if strings.TrimSpace(inputs.ResourceServerIdentifier) == "" {
533+
return fmt.Errorf("resource-server-identifier cannot be empty for resource_server app type")
518534
}
519535
}
520536

internal/cli/apps_test.go

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,54 @@ func TestAppsListCmd(t *testing.T) {
9090
}
9191
}
9292

93+
func TestAppsCreateCmd(t *testing.T) {
94+
tests := []struct {
95+
name string
96+
args []string
97+
expectedError string
98+
}{
99+
{
100+
name: "Resource Server - resource-server-identifier is empty string",
101+
args: []string{
102+
"--name", "My Resource Server App",
103+
"--type", "resource_server",
104+
"--resource-server-identifier", "",
105+
},
106+
expectedError: "resource-server-identifier cannot be empty for resource_server app type",
107+
},
108+
{
109+
name: "Resource Server - resource-server-identifier is whitespace only",
110+
args: []string{
111+
"--name", "My Resource Server App",
112+
"--type", "resource_server",
113+
"--resource-server-identifier", " ",
114+
},
115+
expectedError: "resource-server-identifier cannot be empty for resource_server app type",
116+
},
117+
{
118+
name: "Resource Server - resource-server-identifier is tab/newline",
119+
args: []string{
120+
"--name", "My Resource Server App",
121+
"--type", "resource_server",
122+
"--resource-server-identifier", "\t\n",
123+
},
124+
expectedError: "resource-server-identifier cannot be empty for resource_server app type",
125+
},
126+
}
127+
128+
for _, test := range tests {
129+
t.Run(test.name, func(t *testing.T) {
130+
cli := &cli{}
131+
cli.noInput = true // Non-interactive mode.
132+
cmd := createAppCmd(cli)
133+
cmd.SetArgs(test.args)
134+
err := cmd.Execute()
135+
136+
assert.EqualError(t, err, test.expectedError)
137+
})
138+
}
139+
}
140+
93141
func TestFormatAppSettingsPath(t *testing.T) {
94142
assert.Empty(t, formatAppSettingsPath(""))
95143
assert.Equal(t, "applications/app-id-1/settings", formatAppSettingsPath("app-id-1"))

internal/cli/event_streams.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package cli
22

33
import (
4+
"context"
45
"encoding/json"
56
"errors"
67
"fmt"
@@ -10,7 +11,6 @@ import (
1011

1112
"github.com/auth0/go-auth0/management"
1213
"github.com/spf13/cobra"
13-
"golang.org/x/net/context"
1414

1515
"github.com/auth0/auth0-cli/internal/auth0"
1616

internal/cli/flags.go

Lines changed: 71 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ type Flag struct {
1717
Help string
1818
IsRequired bool
1919
AlwaysPrompt bool
20+
AlsoKnownAs []string
2021
}
2122

2223
func (f Flag) GetName() string {
@@ -36,7 +37,16 @@ func (f Flag) GetIsRequired() bool {
3637
}
3738

3839
func (f *Flag) IsSet(cmd *cobra.Command) bool {
39-
return cmd.Flags().Changed(f.LongForm)
40+
if cmd.Flags().Changed(f.LongForm) {
41+
return true
42+
}
43+
// Check if any alias is set.
44+
for _, alias := range f.AlsoKnownAs {
45+
if cmd.Flags().Changed(alias) {
46+
return true
47+
}
48+
}
49+
return false
4050
}
4151

4252
func (f *Flag) Ask(cmd *cobra.Command, value interface{}, defaultValue *string) error {
@@ -254,6 +264,16 @@ func openEditorFlag(cmd *cobra.Command, f *Flag, value *string, defaultValue str
254264
func registerString(cmd *cobra.Command, f *Flag, value *string, defaultValue string, isUpdate bool) {
255265
cmd.Flags().StringVarP(value, f.LongForm, f.ShortForm, defaultValue, f.Help)
256266

267+
// Set up flag aliases if specified.
268+
if len(f.AlsoKnownAs) > 0 {
269+
flag := cmd.Flags().Lookup(f.LongForm)
270+
if flag != nil {
271+
for _, alias := range f.AlsoKnownAs {
272+
cmd.Flags().StringVar(value, alias, defaultValue, f.Help)
273+
}
274+
}
275+
}
276+
257277
if err := markFlagRequired(cmd, f, isUpdate); err != nil {
258278
panic(auth0.Error(err, "failed to register string flag"))
259279
}
@@ -262,6 +282,16 @@ func registerString(cmd *cobra.Command, f *Flag, value *string, defaultValue str
262282
func registerStringSlice(cmd *cobra.Command, f *Flag, value *[]string, defaultValue []string, isUpdate bool) {
263283
cmd.Flags().StringSliceVarP(value, f.LongForm, f.ShortForm, defaultValue, f.Help)
264284

285+
// Set up flag aliases if specified.
286+
if len(f.AlsoKnownAs) > 0 {
287+
flag := cmd.Flags().Lookup(f.LongForm)
288+
if flag != nil {
289+
for _, alias := range f.AlsoKnownAs {
290+
cmd.Flags().StringSliceVar(value, alias, defaultValue, f.Help)
291+
}
292+
}
293+
}
294+
265295
if err := markFlagRequired(cmd, f, isUpdate); err != nil {
266296
panic(auth0.Error(err, "failed to register string slice flag"))
267297
}
@@ -270,6 +300,16 @@ func registerStringSlice(cmd *cobra.Command, f *Flag, value *[]string, defaultVa
270300
func registerStringMap(cmd *cobra.Command, f *Flag, value *map[string]string, defaultValue map[string]string, isUpdate bool) {
271301
cmd.Flags().StringToStringVarP(value, f.LongForm, f.ShortForm, defaultValue, f.Help)
272302

303+
// Set up flag aliases if specified.
304+
if len(f.AlsoKnownAs) > 0 {
305+
flag := cmd.Flags().Lookup(f.LongForm)
306+
if flag != nil {
307+
for _, alias := range f.AlsoKnownAs {
308+
cmd.Flags().StringToStringVar(value, alias, defaultValue, f.Help)
309+
}
310+
}
311+
}
312+
273313
if err := markFlagRequired(cmd, f, isUpdate); err != nil {
274314
panic(auth0.Error(err, "failed to register string map flag"))
275315
}
@@ -278,6 +318,16 @@ func registerStringMap(cmd *cobra.Command, f *Flag, value *map[string]string, de
278318
func registerInt(cmd *cobra.Command, f *Flag, value *int, defaultValue int, isUpdate bool) {
279319
cmd.Flags().IntVarP(value, f.LongForm, f.ShortForm, defaultValue, f.Help)
280320

321+
// Set up flag aliases if specified.
322+
if len(f.AlsoKnownAs) > 0 {
323+
flag := cmd.Flags().Lookup(f.LongForm)
324+
if flag != nil {
325+
for _, alias := range f.AlsoKnownAs {
326+
cmd.Flags().IntVar(value, alias, defaultValue, f.Help)
327+
}
328+
}
329+
}
330+
281331
if err := markFlagRequired(cmd, f, isUpdate); err != nil {
282332
panic(auth0.Error(err, "failed to register int flag"))
283333
}
@@ -286,6 +336,16 @@ func registerInt(cmd *cobra.Command, f *Flag, value *int, defaultValue int, isUp
286336
func registerIntSlice(cmd *cobra.Command, f *Flag, value *[]int, defaultValue []int, isUpdate bool) {
287337
cmd.Flags().IntSliceVarP(value, f.LongForm, f.ShortForm, defaultValue, f.Help)
288338

339+
// Set up flag aliases if specified.
340+
if len(f.AlsoKnownAs) > 0 {
341+
flag := cmd.Flags().Lookup(f.LongForm)
342+
if flag != nil {
343+
for _, alias := range f.AlsoKnownAs {
344+
cmd.Flags().IntSliceVar(value, alias, defaultValue, f.Help)
345+
}
346+
}
347+
}
348+
289349
if err := markFlagRequired(cmd, f, isUpdate); err != nil {
290350
panic(auth0.Error(err, "failed to register int slice flag"))
291351
}
@@ -330,6 +390,16 @@ func askIntSlice(i commandInput, value *[]int, defaultValue *[]int) error {
330390
func registerBool(cmd *cobra.Command, f *Flag, value *bool, defaultValue bool, isUpdate bool) {
331391
cmd.Flags().BoolVarP(value, f.LongForm, f.ShortForm, defaultValue, f.Help)
332392

393+
// Set up flag aliases if specified.
394+
if len(f.AlsoKnownAs) > 0 {
395+
flag := cmd.Flags().Lookup(f.LongForm)
396+
if flag != nil {
397+
for _, alias := range f.AlsoKnownAs {
398+
cmd.Flags().BoolVar(value, alias, defaultValue, f.Help)
399+
}
400+
}
401+
}
402+
333403
if err := markFlagRequired(cmd, f, isUpdate); err != nil {
334404
panic(auth0.Error(err, "failed to register bool flag"))
335405
}

internal/cli/logs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package cli
22

33
import (
4+
"context"
45
"fmt"
56
"sort"
67
"time"
@@ -9,7 +10,6 @@ import (
910

1011
"github.com/auth0/go-auth0/management"
1112
"github.com/spf13/cobra"
12-
"golang.org/x/net/context"
1313
)
1414

1515
// Besides the limitation of 100 log events per request to retrieve logs,

0 commit comments

Comments
 (0)