style(SearchCommand): Adjusted formatting
This commit is contained in:
parent
995ef1aed9
commit
e27427dfbf
1 changed files with 10 additions and 10 deletions
|
|
@ -4,8 +4,8 @@ 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"
|
||||||
|
proto "lpm-cli/Proto/lpm/go"
|
||||||
"lpm-cli/ProtoHandler"
|
"lpm-cli/ProtoHandler"
|
||||||
proto "lpm-cli/proto/lpm/go"
|
|
||||||
"os"
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -13,16 +13,16 @@ func NewSearchCommand() *cli.Command {
|
||||||
|
|
||||||
logger := Lotus.Logger("searchCommand")
|
logger := Lotus.Logger("searchCommand")
|
||||||
|
|
||||||
return &cli.Command {
|
return &cli.Command{
|
||||||
Name: "search",
|
Name: "search",
|
||||||
Usage: "Seaches a packages",
|
Usage: "Seaches a packages",
|
||||||
Description: "Sends a search request to the default registry server, or to a user-defined registry server",
|
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 {
|
Action: func(c *cli.Context) error {
|
||||||
|
|
||||||
var query string
|
var query string
|
||||||
|
|
||||||
if len(os.Args) > 3{
|
if len(os.Args) > 3 {
|
||||||
query = os.Args[2] + " " + os.Args[3]
|
query = os.Args[2] + " " + os.Args[3]
|
||||||
} else {
|
} else {
|
||||||
query = os.Args[2]
|
query = os.Args[2]
|
||||||
|
|
@ -43,7 +43,7 @@ func NewSearchCommand() *cli.Command {
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
OnUsageError: func(c *cli.Context, err error, isSubcommand bool) error {
|
OnUsageError: func(c *cli.Context, err error, isSubcommand bool) error {
|
||||||
if err != nil{
|
if err != nil {
|
||||||
logger.Fatal(err)
|
logger.Fatal(err)
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
|
|
@ -73,8 +73,8 @@ func SearchPackages(platform string, architecture []string, query string) []Prot
|
||||||
|
|
||||||
for _, reg := range registries {
|
for _, reg := range registries {
|
||||||
res := fetchPackages(platform, architecture, query, reg)
|
res := fetchPackages(platform, architecture, query, reg)
|
||||||
if res != nil{
|
if res != nil {
|
||||||
for _, pkg := range protoWrap.ParsePackages(res, reg){
|
for _, pkg := range protoWrap.ParsePackages(res, reg) {
|
||||||
packages = append(packages, pkg)
|
packages = append(packages, pkg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Reference in a new issue