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

Method removePackages

cmds/cmd_remove.go:110–131  ·  view source on GitHub ↗

removePackages handles the actual package removal.

(nameVersions []string)

Source from the content-addressed store, hash-verified

108
109// removePackages handles the actual package removal.
110func (r *removeCmd) removePackages(nameVersions []string) error {
111 removeOptions := configs.RemoveOptions{
112 Purge: r.purge,
113 Recursive: r.recursive,
114 BuildCache: r.buildCache,
115 }
116
117 for _, nameVersion := range nameVersions {
118 var port configs.Port
119 port.DevDep = r.dev
120
121 if err := port.Init(r.celer, nameVersion); err != nil {
122 return fmt.Errorf("failed to initialize package %s -> %w", nameVersion, err)
123 }
124
125 if err := port.Remove(removeOptions); err != nil {
126 return fmt.Errorf("failed to remove package %s -> %w", nameVersion, err)
127 }
128 }
129
130 return nil
131}
132
133func (r *removeCmd) completion(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
134 var suggestions []string

Callers 1

executeMethod · 0.95

Calls 2

InitMethod · 0.95
RemoveMethod · 0.95

Tested by

no test coverage detected