You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: purge_deployments.go
    path of file: ./repos/devspace/pkg/devspace/pipeline/engine/pipelinehandler/commands
    
    the code of the file until where you have to start completion: package commands

import (
	"fmt"
	"github.com/jessevdk/go-flags"
	devspacecontext "github.com/loft-sh/devspace/pkg/devspace/context"
	"github.com/loft-sh/devspace/pkg/devspace/deploy"
	"github.com/loft-sh/devspace/pkg/devspac
    
func PurgeDeployments(ctx devspacecontext.Context, pipeline types.Pipeline, args []string) error {
	ctx.Log().Debugf("purge_deployments %s", strings.Join(args, " "))
	err := pipeline.Exclude(ctx)
	if err != nil {
		return err
	}
	if ctx.KubeClient() == nil {
		return errors.Errorf(ErrMsg)
	}
	options := &PurgeDeploymentsOptions{
		PurgeOptions: pipeline.Options().PurgeOptions,
	}
	args, err = flags.ParseArgs(options, args)
	if err != nil {
		return errors.Wrap(err, "parse args")
	}

	if !options.All && len(args) == 0 {
		return fmt.Errorf("either specify 'purge_deployments --all' or 'purge_deployments deployment1 deployment2'")
	} else if options.All {
		args = []string{}
		for _, d := range ctx.Config().RemoteCache().ListDeployments() {
			if stringutil.Contains(options.Except, d.Name) {
				continue
			}

			args = append(args, d.Name)
		}
		if len(args) == 0 {
			return nil
		}
	}

	return deploy.NewController().Purge(ctx, args, &options.PurgeOptions)
}