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: bind.go
    path of file: ./repos/juju/cmd/juju/application
    
    the code of the file until where you have to start completion: // Copyright 2019 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.

package application

import (
	"strings"

	"github.com/juju/cmd/v3"
	"github.com/juju/collections/set"
	"github.com/juju/errors"
	"github.com/juju/gnuflag"
	"github.com/juju/names/v5"

	"github.com/juju/juju/api/base"
	"github.com/juju/juju/api/client/application"
	"github.com/juju/juju/api/client/spaces"
	jujucmd "github.com/juju/juju/cmd"
	"github.com/juju/juju/cmd/modelcmd"
	"github.com/juju/juju/rpc/params"
)

// NewBindCommand returns a command which changes the bindings for an application.
func NewBindCommand() cmd.Command {
	cmd := &bindCommand{
		NewApplicationClient: func(conn base.APICallCloser) ApplicationBindClient {
			return application.NewClient(conn)
		},
		NewSpacesClient: func(conn base.APICallCloser) SpacesAPI {
			return spaces.NewAPI(conn)
		},
	}
	return modelcmd.Wrap(cmd)
}

// ApplicationBindClient defines a subset of the application
    
func (c *bindCommand) Run(ctx *cmd.Context) error {
	apiRoot, err := c.NewAPIRoot()
	if err != nil {
		return errors.Trace(err)
	}
	defer func() { _ = apiRoot.Close() }()

	if err = c.parseBindExpression(apiRoot); err != nil && errors.IsNotSupported(err) {
		ctx.Infof("Spaces not supported by this model's cloud, nothing to do.")
		return nil
	} else if err != nil {
		return err
	}

	if len(c.Bindings) == 0 {
		return errors.New("no bindings specified")
	}

	generation, err := c.ActiveBranch()
	if err != nil {
		return errors.Trace(err)
	}

	applicationClient := c.NewApplicationClient(apiRoot)
	applicationInfo, err := applicationClient.Get(generation, c.ApplicationName)
	if err != nil {
		return errors.Trace(err)
	}

	// Validate endpoints and merge operator-defined bindings
	curBindings := applicationInfo.EndpointBindings
	var epList []string
	for epName := range curBindings {
		if epName == "" {
			continue
		}
		epList = append(epList, epName)
	}
	curCharmEndpoints := set.NewStrings(epList...)

	if err := c.validateEndpointNames(curCharmEndpoints, curBindings, c.Bindings); err != nil {
		return errors.Trace(err)
	}

	appDefaultSpace := curBindings[""]

	var bindingsChangelog []string
	c.Bindings, bindingsChangelog = mergeBindings(curCharmEndpoints, curBindings, c.Bindings, appDefaultSpace)

	err = applicationClient.MergeBindings(params.ApplicationMergeBindingsArgs{
		Args: []params.ApplicationMergeBindings{
			{
				ApplicationTag: names.NewApplicationTag(c.ApplicationName).String(),
				Bindings:       c.Bindings,
				Force:          c.Force,
			},
		},
	})
	if err != nil {
		return errors.Trace(err)
	}

	// Emit binding changelog after a successful call to MergeBindings.
	for _, change := range bindingsChangelog {
		ctx.Infof(change)
	}
	return nil
}