Add json output to build

This commit is contained in:
Ettore Di Giacinto
2020-11-03 18:06:56 +01:00
parent d7a04465fd
commit 9aa352dec8
2 changed files with 67 additions and 1 deletions

View File

@@ -32,6 +32,7 @@ type PackageResult struct {
Category string `json:"category"`
Version string `json:"version"`
Repository string `json:"repository"`
Target string `json:"target"`
Hidden bool `json:"hidden"`
}
@@ -39,6 +40,10 @@ type Results struct {
Packages []PackageResult `json:"packages"`
}
func (r PackageResult) String() string {
return fmt.Sprintf("%s/%s-%s required for %s", r.Category, r.Name, r.Version, r.Target)
}
var searchCmd = &cobra.Command{
Use: "search <term>",
Short: "Search packages",