github.com/bitrise-io/go-xamarin@v0.0.0-20211005113058-bf60a8bae851/cli/clean.go (about)

     1  package cli
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"github.com/bitrise-io/go-utils/log"
     7  	"github.com/bitrise-io/go-xamarin/analyzers/project"
     8  	"github.com/bitrise-io/go-xamarin/builder"
     9  	"github.com/bitrise-io/go-xamarin/tools/buildtools"
    10  	"github.com/urfave/cli"
    11  )
    12  
    13  func cleanCmd(c *cli.Context) error {
    14  	solutionPth := c.String(solutionFilePathKey)
    15  
    16  	fmt.Println("")
    17  	log.Infof("Config:")
    18  	log.Printf("- solution: %s", solutionPth)
    19  	fmt.Println("")
    20  
    21  	if solutionPth == "" {
    22  		return fmt.Errorf("missing required input: %s", solutionFilePathKey)
    23  	}
    24  
    25  	buildTool := buildtools.Xbuild
    26  
    27  	builder, err := builder.New(solutionPth, nil, buildTool)
    28  	if err != nil {
    29  		return err
    30  	}
    31  
    32  	callback := func(project project.Model, dir string) {
    33  		log.Printf("  cleaning project: %s (removing: %s)", project.Name, dir)
    34  	}
    35  
    36  	log.Infof("Cleaning solution: %s", solutionPth)
    37  	return builder.CleanAll(callback)
    38  }