Dynamic Search whoop whoop

This commit is contained in:
netbenix 2021-11-20 15:39:52 +01:00
parent f848f8ab14
commit d762d70c78

View file

@ -4,7 +4,6 @@ import (
"github.com/olekukonko/tablewriter" "github.com/olekukonko/tablewriter"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
"lpm-cli/Lotus" "lpm-cli/Lotus"
"lpm-cli/ProtoHandler"
"os" "os"
) )
@ -19,7 +18,15 @@ func NewSearchCommand() *cli.Command {
HelpName: "search", HelpName: "search",
Action: func(c *cli.Context) error { Action: func(c *cli.Context) error {
packages := ProtoHandler.SearchPackages("a platform", []string{"amd64", "i386"}, "chrome") var query string
if len(os.Args) > 3{
query = os.Args[2] + " " + os.Args[3]
} else {
query = os.Args[2]
}
packages := SearchPackages(Lotus.Platform(), Lotus.Architecture(), query)
//sample code //sample code
table := tablewriter.NewWriter(os.Stdout) table := tablewriter.NewWriter(os.Stdout)
@ -40,4 +47,4 @@ func NewSearchCommand() *cli.Command {
return err return err
}, },
} }
} }