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

Method Command

cmds/cmd_update.go:27–65  ·  view source on GitHub ↗
(celer *configs.Celer)

Source from the content-addressed store, hash-verified

25}
26
27func (u *updateCmd) Command(celer *configs.Celer) *cobra.Command {
28 u.celer = celer
29 command := &cobra.Command{
30 Use: "update",
31 Short: "Update conf repo, ports config repo or project repo.",
32 Long: `Update conf repo, ports config repo or project repo.
33
34This command supports three types of updates:
35 1. Update conf repository (configuration files)
36 2. Update ports repository (port configuration files)
37 3. Update source code repositories of third-party libraries
38
39Examples:
40 celer update --conf-repo # Update conf repository
41 celer update --ports-repo # Update ports repository
42 celer update zlib@1.3.1 # Update single port
43 celer update entt@3.16.0 fakeit@2.5.0 # Update multiple ports
44 celer update --recursive ffmpeg@3.4.13 # Update port and all its dependencies
45 celer update --force boost@1.82.0 # Force update (overwrites local changes)`,
46 Args: u.validateArgs,
47 RunE: func(cmd *cobra.Command, args []string) error {
48 return u.doUpdate(args)
49 },
50 ValidArgsFunction: u.completion,
51 }
52
53 // Register flags.
54 command.Flags().BoolVarP(&u.confRepo, "conf-repo", "c", false, "update conf repo")
55 command.Flags().BoolVarP(&u.portsRepo, "ports-repo", "p", false, "update ports repo")
56 command.Flags().BoolVarP(&u.force, "force", "f", false, "update forcibly")
57 command.Flags().BoolVarP(&u.recursive, "recursive", "r", false, "update recursively")
58
59 command.MarkFlagsMutuallyExclusive("conf-repo", "ports-repo")
60
61 // Silence cobra's error and usage output to avoid duplicate messages.
62 command.SilenceErrors = true
63 command.SilenceUsage = true
64 return command
65}
66
67func (u *updateCmd) validateArgs(cmd *cobra.Command, args []string) error {
68 confRepo, err := cmd.Flags().GetBool("conf-repo")

Callers 3

TestUpdateCmd_CompletionFunction · 0.95

Calls 1

doUpdateMethod · 0.95

Tested by 3

TestUpdateCmd_CompletionFunction · 0.76