X Tutup
Skip to content

Commit 74d6eb9

Browse files
committed
Address PR comments
1 parent bda27a4 commit 74d6eb9

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

pkg/cmd/completion/completion.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ import (
66

77
"github.com/MakeNowJust/heredoc"
88
"github.com/cli/cli/pkg/cmdutil"
9+
"github.com/cli/cli/pkg/iostreams"
910
"github.com/spf13/cobra"
1011
)
1112

12-
func NewCmdCompletion(f *cmdutil.Factory) *cobra.Command {
13-
io := f.IOStreams
13+
func NewCmdCompletion(io *iostreams.IOStreams) *cobra.Command {
1414
var shellType string
1515

1616
cmd := &cobra.Command{

pkg/cmd/completion/completion_test.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"strings"
55
"testing"
66

7-
"github.com/cli/cli/pkg/cmdutil"
87
"github.com/cli/cli/pkg/iostreams"
98
"github.com/google/shlex"
109
"github.com/spf13/cobra"
@@ -46,10 +45,7 @@ func TestNewCmdCompletion(t *testing.T) {
4645
for _, tt := range tests {
4746
t.Run(tt.name, func(t *testing.T) {
4847
io, _, stdout, stderr := iostreams.Test()
49-
f := &cmdutil.Factory{
50-
IOStreams: io,
51-
}
52-
completeCmd := NewCmdCompletion(f)
48+
completeCmd := NewCmdCompletion(io)
5349
rootCmd := &cobra.Command{Use: "gh"}
5450
rootCmd.AddCommand(completeCmd)
5551

pkg/cmd/root/root.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ func NewCmdRoot(f *cmdutil.Factory, version, buildDate string) *cobra.Command {
6767
cmd.AddCommand(configCmd.NewCmdConfig(f))
6868
cmd.AddCommand(creditsCmd.NewCmdCredits(f, nil))
6969
cmd.AddCommand(gistCmd.NewCmdGist(f))
70-
cmd.AddCommand(completionCmd.NewCmdCompletion(f))
70+
cmd.AddCommand(completionCmd.NewCmdCompletion(f.IOStreams))
7171

7272
// the `api` command should not inherit any extra HTTP headers
7373
bareHTTPCmdFactory := *f

0 commit comments

Comments
 (0)
X Tutup