func LoadPlugin(path string) (*Plugin, error) {
	const metadataFileName = "plugin.yaml"

	pluginPath := filepath.Join(path, metadataFileName)
	data, err := ioutil.ReadFile(pluginPath)
	if err != nil {
		return nil, fmt.Errorf("read plugin file: %w", err)
	}

	plugin := &Plugin{
		Dir:    path,
		stdIn:  os.Stdin,
		stdOut: os.Stdout,
		stdErr: os.Stderr,
		env:    os.Environ(),
	}

	if err := yaml.Unmarshal(data, &plugin.MetaData); err != nil {
		return nil, fmt.Errorf("parse plugin file: %w", err)
	}

	return plugin, nil
}
// LoadPlugin loads the plugin.yaml from the given path
// and parses the metadata into a Plugin struct
LoadPlugin loads the plugin.yaml from the given path
and parses the metadata into a Plugin struct
// LoadPlugin loads the plugin . yaml from the given path // and parses the metadata into a Plugin struct
func LoadPlugin(path string) (*Plugin, error) {
	const metadataFileName = "plugin.yaml"
	pluginPath := filepath.Join(path, metadataFileName)
	data, err := ioutil.ReadFile(pluginPath)
	if err != nil {
		return nil, fmt.Errorf("read plugin file: %w", err)
	}
	plugin := &Plugin{
		Dir:    path,
		stdIn:  os.Stdin,
		stdOut: os.Stdout,
		stdErr: os.Stderr,
		env:    os.Environ(),
	}
	if err := yaml.Unmarshal(data, &plugin.MetaData); err != nil {
		return nil, fmt.Errorf("parse plugin file: %w", err)
	}
	return plugin, nil
}
func LoadPlugin ( path string ) ( * Plugin , error ) { const metadataFileName = " " pluginPath := filepath . Join ( path , metadataFileName ) data , err := ioutil . ReadFile ( pluginPath ) if err != nil { return nil , fmt . Errorf ( " " , err ) } plugin := & Plugin { Dir : path , stdIn : os . Stdin , stdOut : os . Stdout , stdErr : os . Stderr , env : os . Environ ( ) , } if err := yaml . Unmarshal ( data , & plugin . MetaData ) ; err != nil { return nil , fmt . Errorf ( " " , err ) } return plugin , nil }
LoadPlugin loads the plugin.yaml from the given path
and parses the metadata into a Plugin struct
LoadPlugin loads the plugin . yaml from the given path and parses the metadata into a Plugin struct