MCPcopy
hub / github.com/cli/cli / runCopy

Function runCopy

pkg/cmd/project/copy/copy.go:88–120  ·  view source on GitHub ↗
(config copyConfig)

Source from the content-addressed store, hash-verified

86}
87
88func runCopy(config copyConfig) error {
89 canPrompt := config.io.CanPrompt()
90 sourceOwner, err := config.client.NewOwner(canPrompt, config.opts.sourceOwner)
91 if err != nil {
92 return err
93 }
94
95 targetOwner, err := config.client.NewOwner(canPrompt, config.opts.targetOwner)
96 if err != nil {
97 return err
98 }
99
100 project, err := config.client.NewProject(canPrompt, sourceOwner, config.opts.number, false)
101 if err != nil {
102 return err
103 }
104
105 config.opts.projectID = project.ID
106 config.opts.ownerID = targetOwner.ID
107
108 query, variables := copyArgs(config)
109
110 err = config.client.Mutate("CopyProjectV2", query, variables)
111 if err != nil {
112 return err
113 }
114
115 if config.opts.exporter != nil {
116 return config.opts.exporter.Write(config.io, query.CopyProjectV2.ProjectV2)
117 }
118
119 return printResults(config, query.CopyProjectV2.ProjectV2)
120}
121
122func copyArgs(config copyConfig) (*copyProjectMutation, map[string]interface{}) {
123 return &copyProjectMutation{}, map[string]interface{}{

Callers 5

NewCmdCopyFunction · 0.85
TestRunCopy_UserFunction · 0.85
TestRunCopy_OrgFunction · 0.85
TestRunCopy_MeFunction · 0.85
TestRunCopy_JSONFunction · 0.85

Calls 7

copyArgsFunction · 0.85
CanPromptMethod · 0.80
NewOwnerMethod · 0.80
NewProjectMethod · 0.80
printResultsFunction · 0.70
MutateMethod · 0.65
WriteMethod · 0.65

Tested by 4

TestRunCopy_UserFunction · 0.68
TestRunCopy_OrgFunction · 0.68
TestRunCopy_MeFunction · 0.68
TestRunCopy_JSONFunction · 0.68