MCPcopy Create free account
hub / github.com/cli/cli / createRun

Function createRun

pkg/cmd/repo/create/create.go:264–293  ·  view source on GitHub ↗
(opts *CreateOptions)

Source from the content-addressed store, hash-verified

262}
263
264func createRun(opts *CreateOptions) error {
265 if opts.Interactive {
266 cfg, err := opts.Config()
267 if err != nil {
268 return err
269 }
270 host, _ := cfg.Authentication().DefaultHost()
271 answer, err := opts.Prompter.Select("What would you like to do?", "", []string{
272 fmt.Sprintf("Create a new repository on %s from scratch", host),
273 fmt.Sprintf("Create a new repository on %s from a template repository", host),
274 fmt.Sprintf("Push an existing local repository to %s", host),
275 })
276 if err != nil {
277 return err
278 }
279 switch answer {
280 case 0:
281 return createFromScratch(opts)
282 case 1:
283 return createFromTemplate(opts)
284 case 2:
285 return createFromLocal(opts)
286 }
287 }
288
289 if opts.Source == "" {
290 return createFromScratch(opts)
291 }
292 return createFromLocal(opts)
293}
294
295// create new repo on remote host
296func createFromScratch(opts *CreateOptions) error {

Callers 2

Test_createRunFunction · 0.70
NewCmdCreateFunction · 0.70

Calls 7

createFromScratchFunction · 0.85
createFromTemplateFunction · 0.85
createFromLocalFunction · 0.85
ConfigMethod · 0.65
DefaultHostMethod · 0.65
AuthenticationMethod · 0.65
SelectMethod · 0.65

Tested by 1

Test_createRunFunction · 0.56