github.com/swisscom/cloudfoundry-cli@v7.1.0+incompatible/cf/configuration/pluginconfig/plugin_data.go (about)

     1  package pluginconfig
     2  
     3  import (
     4  	"encoding/json"
     5  
     6  	"code.cloudfoundry.org/cli/plugin"
     7  )
     8  
     9  type PluginData struct {
    10  	Plugins map[string]PluginMetadata
    11  }
    12  
    13  type PluginMetadata struct {
    14  	Location string
    15  	Version  plugin.VersionType
    16  	Commands []plugin.Command
    17  }
    18  
    19  func NewData() *PluginData {
    20  	return &PluginData{
    21  		Plugins: make(map[string]PluginMetadata),
    22  	}
    23  }
    24  
    25  func (pd *PluginData) JSONMarshalV3() (output []byte, err error) {
    26  	return json.MarshalIndent(pd, "", "  ")
    27  }
    28  
    29  func (pd *PluginData) JSONUnmarshalV3(input []byte) (err error) {
    30  	return json.Unmarshal(input, pd)
    31  }