X Tutup
Skip to content

Commit c39dc28

Browse files
committed
Rename auth/client to auth/shared
1 parent d56d92c commit c39dc28

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
lines changed

pkg/cmd/auth/login/login.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
"github.com/cli/cli/internal/config"
1717
"github.com/cli/cli/internal/ghinstance"
1818
"github.com/cli/cli/internal/run"
19-
"github.com/cli/cli/pkg/cmd/auth/client"
19+
"github.com/cli/cli/pkg/cmd/auth/shared"
2020
"github.com/cli/cli/pkg/cmdutil"
2121
"github.com/cli/cli/pkg/iostreams"
2222
"github.com/cli/cli/pkg/prompt"
@@ -138,7 +138,7 @@ func loginRun(opts *LoginOptions) error {
138138
return err
139139
}
140140

141-
err = client.ValidateHostCfg(opts.Hostname, cfg)
141+
err = shared.ValidateHostCfg(opts.Hostname, cfg)
142142
if err != nil {
143143
return err
144144
}
@@ -182,9 +182,9 @@ func loginRun(opts *LoginOptions) error {
182182
existingToken, _ := cfg.Get(hostname, "oauth_token")
183183

184184
if existingToken != "" && opts.Interactive {
185-
err := client.ValidateHostCfg(hostname, cfg)
185+
err := shared.ValidateHostCfg(hostname, cfg)
186186
if err == nil {
187-
apiClient, err := client.ClientFromCfg(hostname, cfg)
187+
apiClient, err := shared.ClientFromCfg(hostname, cfg)
188188
if err != nil {
189189
return err
190190
}
@@ -258,7 +258,7 @@ func loginRun(opts *LoginOptions) error {
258258
return err
259259
}
260260

261-
err = client.ValidateHostCfg(hostname, cfg)
261+
err = shared.ValidateHostCfg(hostname, cfg)
262262
if err != nil {
263263
return err
264264
}
@@ -294,7 +294,7 @@ func loginRun(opts *LoginOptions) error {
294294
if userValidated {
295295
username, _ = cfg.Get(hostname, "user")
296296
} else {
297-
apiClient, err := client.ClientFromCfg(hostname, cfg)
297+
apiClient, err := shared.ClientFromCfg(hostname, cfg)
298298
if err != nil {
299299
return err
300300
}

pkg/cmd/auth/login/login_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88

99
"github.com/cli/cli/api"
1010
"github.com/cli/cli/internal/config"
11-
"github.com/cli/cli/pkg/cmd/auth/client"
11+
"github.com/cli/cli/pkg/cmd/auth/shared"
1212
"github.com/cli/cli/pkg/cmdutil"
1313
"github.com/cli/cli/pkg/httpmock"
1414
"github.com/cli/cli/pkg/iostreams"
@@ -262,11 +262,11 @@ func Test_loginRun_nontty(t *testing.T) {
262262
tt.opts.IO = io
263263
t.Run(tt.name, func(t *testing.T) {
264264
reg := &httpmock.Registry{}
265-
origClientFromCfg := client.ClientFromCfg
265+
origClientFromCfg := shared.ClientFromCfg
266266
defer func() {
267-
client.ClientFromCfg = origClientFromCfg
267+
shared.ClientFromCfg = origClientFromCfg
268268
}()
269-
client.ClientFromCfg = func(_ string, _ config.Config) (*api.Client, error) {
269+
shared.ClientFromCfg = func(_ string, _ config.Config) (*api.Client, error) {
270270
httpClient := &http.Client{Transport: reg}
271271
return api.NewClientFromHTTP(httpClient), nil
272272
}
@@ -429,11 +429,11 @@ func Test_loginRun_Survey(t *testing.T) {
429429

430430
t.Run(tt.name, func(t *testing.T) {
431431
reg := &httpmock.Registry{}
432-
origClientFromCfg := client.ClientFromCfg
432+
origClientFromCfg := shared.ClientFromCfg
433433
defer func() {
434-
client.ClientFromCfg = origClientFromCfg
434+
shared.ClientFromCfg = origClientFromCfg
435435
}()
436-
client.ClientFromCfg = func(_ string, _ config.Config) (*api.Client, error) {
436+
shared.ClientFromCfg = func(_ string, _ config.Config) (*api.Client, error) {
437437
httpClient := &http.Client{Transport: reg}
438438
return api.NewClientFromHTTP(httpClient), nil
439439
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package client
1+
package shared
22

33
import (
44
"fmt"

pkg/cmd/auth/status/status_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88

99
"github.com/cli/cli/api"
1010
"github.com/cli/cli/internal/config"
11-
"github.com/cli/cli/pkg/cmd/auth/client"
11+
"github.com/cli/cli/pkg/cmd/auth/shared"
1212
"github.com/cli/cli/pkg/cmdutil"
1313
"github.com/cli/cli/pkg/httpmock"
1414
"github.com/cli/cli/pkg/iostreams"
@@ -217,11 +217,11 @@ func Test_statusRun(t *testing.T) {
217217
}
218218

219219
reg := &httpmock.Registry{}
220-
origClientFromCfg := client.ClientFromCfg
220+
origClientFromCfg := shared.ClientFromCfg
221221
defer func() {
222-
client.ClientFromCfg = origClientFromCfg
222+
shared.ClientFromCfg = origClientFromCfg
223223
}()
224-
client.ClientFromCfg = func(_ string, _ config.Config) (*api.Client, error) {
224+
shared.ClientFromCfg = func(_ string, _ config.Config) (*api.Client, error) {
225225
httpClient := &http.Client{Transport: reg}
226226
return api.NewClientFromHTTP(httpClient), nil
227227
}

0 commit comments

Comments
 (0)
X Tutup