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