(cmd *cobra.Command, args []string, flags *createCmdFlags)
| 71 | } |
| 72 | |
| 73 | func runCreateCmd(cmd *cobra.Command, args []string, flags *createCmdFlags) error { |
| 74 | path := handlePath(args, flags) |
| 75 | |
| 76 | var err error |
| 77 | if flags.template != "" { |
| 78 | err = templates.InitFromName(cmd.ErrOrStderr(), flags.template, path) |
| 79 | } else if flags.repo != "" { |
| 80 | err = templates.InitFromRepo(cmd.ErrOrStderr(), flags.repo, flags.subdir, path) |
| 81 | } else { |
| 82 | err = usererr.New("either --template or --repo need to be specified") |
| 83 | } |
| 84 | if err != nil { |
| 85 | return err |
| 86 | } |
| 87 | |
| 88 | ux.Fsuccessf( |
| 89 | cmd.ErrOrStderr(), |
| 90 | "Initialized devbox project using template %s\n", |
| 91 | flags.template, |
| 92 | ) |
| 93 | |
| 94 | return nil |
| 95 | } |
| 96 | |
| 97 | func handlePath(args []string, flags *createCmdFlags) string { |
| 98 | path := pathArg(args) |
no test coverage detected