Address PR comments
This commit is contained in:
parent
bda27a46ae
commit
74d6eb96be
3 changed files with 4 additions and 8 deletions
|
|
@ -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{
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue