github.com/kaisenlinux/docker.io@v0.0.0-20230510090727-ea55db55fac7/cli/cli-plugins/manager/candidate.go (about)

     1  package manager
     2  
     3  import (
     4  	exec "golang.org/x/sys/execabs"
     5  )
     6  
     7  // Candidate represents a possible plugin candidate, for mocking purposes
     8  type Candidate interface {
     9  	Path() string
    10  	Metadata() ([]byte, error)
    11  }
    12  
    13  type candidate struct {
    14  	path string
    15  }
    16  
    17  func (c *candidate) Path() string {
    18  	return c.path
    19  }
    20  
    21  func (c *candidate) Metadata() ([]byte, error) {
    22  	return exec.Command(c.path, MetadataSubcommandName).Output()
    23  }