Changed sample code
This commit is contained in:
parent
0a7d8313b7
commit
f159c54884
1 changed files with 11 additions and 3 deletions
|
|
@ -1,10 +1,11 @@
|
|||
package Commands
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/urfave/cli/v2"
|
||||
"github.com/olekukonko/tablewriter"
|
||||
"lpm-cli/Lotus"
|
||||
"lpm-cli/ProtoHandler"
|
||||
"os"
|
||||
)
|
||||
|
||||
func NewSearchCommand() *cli.Command {
|
||||
|
|
@ -20,8 +21,15 @@ func NewSearchCommand() *cli.Command {
|
|||
|
||||
packages := ProtoHandler.SearchPackages("a platform", []string{"amd64", "i386"}, "chrome")
|
||||
|
||||
//Sample code
|
||||
fmt.Printf(packages[0].Name)
|
||||
//sample code
|
||||
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
|
||||
},
|
||||
|
|
|
|||
Reference in a new issue