From f159c5488400f699d683a136453f4a2f6728ed5e Mon Sep 17 00:00:00 2001 From: netbenix Date: Sun, 7 Nov 2021 21:46:37 +0100 Subject: [PATCH] Changed sample code --- Commands/SearchCommand.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Commands/SearchCommand.go b/Commands/SearchCommand.go index 173411b..2004c42 100644 --- a/Commands/SearchCommand.go +++ b/Commands/SearchCommand.go @@ -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 },