func (p Plugin) PluginCommands() []PluginCommand {
	sort.Slice(p.Commands, func(i, j int) bool {
		return strings.ToLower(p.Commands[i].Name) < strings.ToLower(p.Commands[j].Name)
	})
	return p.Commands
}
PluginCommands returns the plugin's commands sorted by command name.
package configv3
import (
	"encoding/json"
	"fmt"
	"io/ioutil"
	"os"
	"path/filepath"
	"sort"
	"strings"
	"code.cloudfoundry.org/cli/util"
)
type PluginsConfig struct {
	Plugins map[string]Plugin `json:"Plugins"`
}
type Plugin struct {
	Name     string
	Location string          `json:"Location"`
	Version  PluginVersion   `json:"Version"`
	Commands []PluginCommand `json:"Commands"`
}
type PluginVersion struct {
	Major int `json:"Major"`
	Minor int `json:"Minor"`
	Build int `json:"Build"`
}
func (v PluginVersion) String() string {
	if v.Major == 0 && v.Minor == 0 && v.Build == 0 {
		return "N/A"
	}
	return fmt.Sprintf("%d.%d.%d", v.Major, v.Minor, v.Build)
}
type PluginCommand struct {
	Name         string             `json:"Name"`
	Alias        string             `json:"Alias"`
	HelpText     string             `json:"HelpText"`
	UsageDetails PluginUsageDetails `json:"UsageDetails"`
}
type PluginUsageDetails struct {
	Usage   string            `json:"Usage"`
	Options map[string]string `json:"Options"`
}
func (config *Config) Plugins() []Plugin {
	plugins := []Plugin{}
	for _, plugin := range config.pluginsConfig.Plugins {
		plugins = append(plugins, plugin)
	}
	sort.Slice(plugins, func(i, j int) bool {
		return strings.ToLower(plugins[i].Name) < strings.ToLower(plugins[j].Name)
	})
	return plugins
}
func (p Plugin) CalculateSHA1() string {
	fileSHA, err := util.NewSha1Checksum(p.Location).ComputeFileSha1()
	if err != nil {
		return "N/A"
	}
	return fmt.Sprintf("%x", fileSHA)
}