From a7e2fc49b0be58c25e69571504076cb8537c6bd9 Mon Sep 17 00:00:00 2001 From: whi-tw Date: Thu, 6 Jul 2023 07:02:32 +0100 Subject: [PATCH] Use SmartBaseRepoFunc for api command (#7594) --- pkg/cmd/root/root.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pkg/cmd/root/root.go b/pkg/cmd/root/root.go index 2929ca720..59f576f23 100644 --- a/pkg/cmd/root/root.go +++ b/pkg/cmd/root/root.go @@ -133,13 +133,6 @@ func NewCmdRoot(f *cmdutil.Factory, version, buildDate string) (*cobra.Command, cmd.AddCommand(sshKeyCmd.NewCmdSSHKey(f)) cmd.AddCommand(statusCmd.NewCmdStatus(f, nil)) cmd.AddCommand(newCodespaceCmd(f)) - - // the `api` command should not inherit any extra HTTP headers - bareHTTPCmdFactory := *f - bareHTTPCmdFactory.HttpClient = bareHTTPClient(f, version) - - cmd.AddCommand(apiCmd.NewCmdApi(&bareHTTPCmdFactory, nil)) - cmd.AddCommand(projectCmd.NewCmdProject(f)) // below here at the commands that require the "intelligent" BaseRepo resolver @@ -156,6 +149,13 @@ func NewCmdRoot(f *cmdutil.Factory, version, buildDate string) (*cobra.Command, cmd.AddCommand(workflowCmd.NewCmdWorkflow(&repoResolvingCmdFactory)) cmd.AddCommand(labelCmd.NewCmdLabel(&repoResolvingCmdFactory)) + // the `api` command should not inherit any extra HTTP headers + bareHTTPCmdFactory := *f + bareHTTPCmdFactory.HttpClient = bareHTTPClient(f, version) + bareHTTPCmdFactory.BaseRepo = factory.SmartBaseRepoFunc(&bareHTTPCmdFactory) + + cmd.AddCommand(apiCmd.NewCmdApi(&bareHTTPCmdFactory, nil)) + // Help topics var referenceCmd *cobra.Command for _, ht := range HelpTopics {