removePackages handles the actual package removal.
(nameVersions []string)
| 108 | |
| 109 | // removePackages handles the actual package removal. |
| 110 | func (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 | |
| 133 | func (r *removeCmd) completion(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { |
| 134 | var suggestions []string |