| 262 | } |
| 263 | |
| 264 | func 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 |
| 296 | func createFromScratch(opts *CreateOptions) error { |