Skip to content

Commit 96eec94

Browse files
authored
Merge branch 'main' into dependabot/go_modules/github.com/hashicorp/go-version-1.8.0
2 parents 021e195 + 5a51185 commit 96eec94

File tree

4 files changed

+73
-8
lines changed

4 files changed

+73
-8
lines changed

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ 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
@@ -31,7 +31,7 @@ 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

go.sum

Lines changed: 5 additions & 4 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=
@@ -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,6 +257,7 @@ 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=

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"))

0 commit comments

Comments
 (0)