MCPcopy
hub / github.com/cli/cli / transferRun

Function transferRun

pkg/cmd/issue/transfer/transfer.go:69–100  ·  view source on GitHub ↗
(opts *TransferOptions)

Source from the content-addressed store, hash-verified

67}
68
69func transferRun(opts *TransferOptions) error {
70 httpClient, err := opts.HttpClient()
71 if err != nil {
72 return err
73 }
74
75 baseRepo, err := opts.BaseRepo()
76 if err != nil {
77 return err
78 }
79
80 issue, err := shared.FindIssueOrPR(httpClient, baseRepo, opts.IssueNumber, []string{"id", "number"})
81 if err != nil {
82 return err
83 }
84 if issue.IsPullRequest() {
85 return fmt.Errorf("issue %s#%d is a pull request and cannot be transferred", ghrepo.FullName(baseRepo), issue.Number)
86 }
87
88 destRepo, err := ghrepo.FromFullNameWithHost(opts.DestRepoSelector, baseRepo.RepoHost())
89 if err != nil {
90 return err
91 }
92
93 url, err := issueTransfer(httpClient, issue.ID, destRepo)
94 if err != nil {
95 return err
96 }
97
98 _, err = fmt.Fprintln(opts.IO.Out, url)
99 return err
100}
101
102func issueTransfer(httpClient *http.Client, issueID string, destRepo ghrepo.Interface) (string, error) {
103 var destinationRepoID string

Callers 1

NewCmdTransferFunction · 0.85

Calls 8

FindIssueOrPRFunction · 0.92
FullNameFunction · 0.92
FromFullNameWithHostFunction · 0.92
issueTransferFunction · 0.85
BaseRepoMethod · 0.65
ErrorfMethod · 0.65
RepoHostMethod · 0.65
IsPullRequestMethod · 0.45

Tested by

no test coverage detected