📋 ExecWithList
Lists all available vendor binaries in the project. Equivalent to running composer exec --list and parsing the output.
When to use
Use it when you need to enumerate which tools are callable under vendor/bin programmatically, or to provide a candidate list for ExecAll.
Signature
go
func (c *Composer) ExecWithList() ([]string, error)Parameters
This method takes no parameters.
Return value
| Return value | Type | Description |
|---|---|---|
| First return value | []string | List of available binary file names |
| Second return value | error | Returned when execution or parsing fails |
Parsing rules
The output is split by lines; empty lines and the Available binaries: header line are removed, and the remaining entries are returned.
Example
go
package main
import (
"fmt"
"log"
"github.com/scagogogo/composer-skills/pkg/composer"
)
func main() {
comp, err := composer.New(composer.DefaultOptions())
if err != nil {
log.Fatalf("initialization failed: %v", err)
}
binaries, err := comp.ExecWithList()
if err != nil {
log.Fatalf("failed to list binaries: %v", err)
}
fmt.Println("Available vendor binaries:")
for _, b := range binaries {
fmt.Println(" -", b)
}
}