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

Method execute

cmds/cmd_clean.go:85–110  ·  view source on GitHub ↗
(args []string)

Source from the content-addressed store, hash-verified

83}
84
85func (c *cleanCmd) execute(args []string) error {
86 if err := c.celer.Init(); err != nil {
87 return color.PrintError(err, "failed to init celer.")
88 }
89
90 // Must check tool after celer initialized, since "downloads" will be assign value after init.
91 if err := buildtools.CheckTools(c.celer, "git"); err != nil {
92 return err
93 }
94
95 if c.all {
96 if err := c.cleanAll(); err != nil {
97 return color.PrintError(err, "failed to clean all packages.")
98 }
99 } else {
100 if err := c.validateTargets(args); err != nil {
101 return color.PrintError(err, "invalid arguments.")
102 }
103
104 if err := c.clean(args...); err != nil {
105 return color.PrintError(err, "failed to clean %s", strings.Join(args, ", "))
106 }
107 }
108
109 return nil
110}
111
112func (c *cleanCmd) validateTargets(targets []string) error {
113 if len(targets) == 0 {

Callers 1

CommandMethod · 0.95

Calls 6

cleanAllMethod · 0.95
validateTargetsMethod · 0.95
cleanMethod · 0.95
PrintErrorFunction · 0.92
CheckToolsFunction · 0.92
InitMethod · 0.65

Tested by

no test coverage detected