Address PR comments

This commit is contained in:
Sam Coe 2020-09-30 12:52:45 +02:00
parent bda27a46ae
commit 74d6eb96be
No known key found for this signature in database
GPG key ID: 8E322C20F811D086
3 changed files with 4 additions and 8 deletions

View file

@ -6,11 +6,11 @@ import (
"github.com/MakeNowJust/heredoc"
"github.com/cli/cli/pkg/cmdutil"
"github.com/cli/cli/pkg/iostreams"
"github.com/spf13/cobra"
)
func NewCmdCompletion(f *cmdutil.Factory) *cobra.Command {
io := f.IOStreams
func NewCmdCompletion(io *iostreams.IOStreams) *cobra.Command {
var shellType string
cmd := &cobra.Command{

View file

@ -4,7 +4,6 @@ import (
"strings"
"testing"
"github.com/cli/cli/pkg/cmdutil"
"github.com/cli/cli/pkg/iostreams"
"github.com/google/shlex"
"github.com/spf13/cobra"
@ -46,10 +45,7 @@ func TestNewCmdCompletion(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
io, _, stdout, stderr := iostreams.Test()
f := &cmdutil.Factory{
IOStreams: io,
}
completeCmd := NewCmdCompletion(f)
completeCmd := NewCmdCompletion(io)
rootCmd := &cobra.Command{Use: "gh"}
rootCmd.AddCommand(completeCmd)

View file

@ -67,7 +67,7 @@ func NewCmdRoot(f *cmdutil.Factory, version, buildDate string) *cobra.Command {
cmd.AddCommand(configCmd.NewCmdConfig(f))
cmd.AddCommand(creditsCmd.NewCmdCredits(f, nil))
cmd.AddCommand(gistCmd.NewCmdGist(f))
cmd.AddCommand(completionCmd.NewCmdCompletion(f))
cmd.AddCommand(completionCmd.NewCmdCompletion(f.IOStreams))
// the `api` command should not inherit any extra HTTP headers
bareHTTPCmdFactory := *f