MCPcopy Index your code
hub / github.com/jetify-com/devbox / runCreateCmd

Function runCreateCmd

internal/boxcli/create.go:73–95  ·  view source on GitHub ↗
(cmd *cobra.Command, args []string, flags *createCmdFlags)

Source from the content-addressed store, hash-verified

71}
72
73func 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
97func handlePath(args []string, flags *createCmdFlags) string {
98 path := pathArg(args)

Callers 1

createCmdFunction · 0.85

Calls 5

InitFromNameFunction · 0.92
InitFromRepoFunction · 0.92
NewFunction · 0.92
FsuccessfFunction · 0.92
handlePathFunction · 0.85

Tested by

no test coverage detected