Changed sample code

This commit is contained in:
netbenix 2021-11-07 21:46:37 +01:00
parent 0a7d8313b7
commit f159c54884

View file

@ -1,10 +1,11 @@
package Commands package Commands
import ( import (
"fmt"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
"github.com/olekukonko/tablewriter"
"lpm-cli/Lotus" "lpm-cli/Lotus"
"lpm-cli/ProtoHandler" "lpm-cli/ProtoHandler"
"os"
) )
func NewSearchCommand() *cli.Command { func NewSearchCommand() *cli.Command {
@ -20,8 +21,15 @@ func NewSearchCommand() *cli.Command {
packages := ProtoHandler.SearchPackages("a platform", []string{"amd64", "i386"}, "chrome") packages := ProtoHandler.SearchPackages("a platform", []string{"amd64", "i386"}, "chrome")
//Sample code //sample code
fmt.Printf(packages[0].Name) table := tablewriter.NewWriter(os.Stdout)
table.SetHeader([]string{"Publisher", "Package", "Description", "Latest Version", "Registry"})
for _, pkg := range packages {
table.Append([]string{pkg.Publisher, pkg.Name, pkg.Description, pkg.Version, "[core]"})
}
table.Render()
//Sample code end
return nil return nil
}, },