Use SmartBaseRepoFunc for api command (#7594)

This commit is contained in:
whi-tw 2023-07-06 07:02:32 +01:00 committed by GitHub
parent 8a7d80864b
commit a7e2fc49b0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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 {