style(SearchCommand): Adjusted formatting

This commit is contained in:
netbenix 2022-08-27 12:48:20 +02:00
parent 995ef1aed9
commit e27427dfbf

View file

@ -4,8 +4,8 @@ import (
"github.com/olekukonko/tablewriter"
"github.com/urfave/cli/v2"
"lpm-cli/Lotus"
proto "lpm-cli/Proto/lpm/go"
"lpm-cli/ProtoHandler"
proto "lpm-cli/proto/lpm/go"
"os"
)
@ -13,16 +13,16 @@ func NewSearchCommand() *cli.Command {
logger := Lotus.Logger("searchCommand")
return &cli.Command {
Name: "search",
Usage: "Seaches a packages",
return &cli.Command{
Name: "search",
Usage: "Seaches a packages",
Description: "Sends a search request to the default registry server, or to a user-defined registry server",
HelpName: "search",
HelpName: "search",
Action: func(c *cli.Context) error {
var query string
if len(os.Args) > 3{
if len(os.Args) > 3 {
query = os.Args[2] + " " + os.Args[3]
} else {
query = os.Args[2]
@ -43,7 +43,7 @@ func NewSearchCommand() *cli.Command {
return nil
},
OnUsageError: func(c *cli.Context, err error, isSubcommand bool) error {
if err != nil{
if err != nil {
logger.Fatal(err)
}
return err
@ -73,12 +73,12 @@ func SearchPackages(platform string, architecture []string, query string) []Prot
for _, reg := range registries {
res := fetchPackages(platform, architecture, query, reg)
if res != nil{
for _, pkg := range protoWrap.ParsePackages(res, reg){
if res != nil {
for _, pkg := range protoWrap.ParsePackages(res, reg) {
packages = append(packages, pkg)
}
}
}
return packages
}
}