MCPcopy Create free account
hub / github.com/celer-pkg/celer / Command

Method Command

cmds/cmd_create.go:20–58  ·  view source on GitHub ↗
(celer *configs.Celer)

Source from the content-addressed store, hash-verified

18}
19
20func (c *createCmd) Command(celer *configs.Celer) *cobra.Command {
21 c.celer = celer
22 command := &cobra.Command{
23 Use: "create",
24 Short: "Create a platform, project or port.",
25 Long: `Create a platform, project or port.
26
27This command helps you scaffold new configurations for different components
28in the celer package manager. You must specify exactly one type of component
29to create using the mutually exclusive flags.
30
31COMPONENT TYPES:
32 --platform Create a new platform configuration (e.g., windows-x86_64, linux-x64)
33 --project Create a new project configuration
34 --port Create a new port with name@version format
35
36EXAMPLES:
37 celer create --platform windows-x86_64-msvc
38 celer create --project my-awesome-project
39 celer create --port opencv@4.8.0`,
40 Args: cobra.NoArgs,
41 RunE: func(cmd *cobra.Command, args []string) error {
42 return c.doCreate(cmd)
43 },
44 ValidArgsFunction: c.completion,
45 }
46
47 // Register flags.
48 command.Flags().StringVar(&c.platform, "platform", "", "create a new platform.")
49 command.Flags().StringVar(&c.project, "project", "", "create a new project.")
50 command.Flags().StringVar(&c.port, "port", "", "create a new port.")
51
52 command.MarkFlagsMutuallyExclusive("platform", "project", "port")
53
54 // Silence cobra's error and usage output to avoid duplicate messages.
55 command.SilenceErrors = true
56 command.SilenceUsage = true
57 return command
58}
59
60func (c *createCmd) createPlatform(platformName string) error {
61 if err := c.celer.CreatePlatform(platformName); err != nil {

Callers 4

TestCreateCmd_CompletionFunction · 0.95
TestCreateCmdFunction · 0.95

Calls 1

doCreateMethod · 0.95

Tested by 4

TestCreateCmd_CompletionFunction · 0.76
TestCreateCmdFunction · 0.76