mirror of
https://codeberg.org/scip/esctl.git
synced 2026-08-24 08:14:18 +02:00
Add CCR stuff, fix search, add docs support, support index maps, refactor (#13)
This commit is contained in:
@@ -18,6 +18,7 @@ package cmd
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
"codeberg.org/scip/esctl/pkg/cfg"
|
||||
"codeberg.org/scip/esctl/pkg/es"
|
||||
@@ -30,7 +31,7 @@ func Search(conf *cfg.Config) *cli.Command {
|
||||
Name: "search",
|
||||
Aliases: []string{"/"},
|
||||
Usage: "search within an index",
|
||||
UsageText: "search [options] <query>",
|
||||
UsageText: "search [options] <field=pattern> ...",
|
||||
|
||||
Flags: []cli.Flag{
|
||||
&cli.StringFlag{
|
||||
@@ -63,11 +64,12 @@ func Search(conf *cfg.Config) *cli.Command {
|
||||
},
|
||||
|
||||
Action: func(ctx context.Context, cmd *cli.Command) error {
|
||||
if err := es.Search(conf, cmd.Args().Get(0)); err != nil {
|
||||
return err
|
||||
args := cmd.Args()
|
||||
if args.Len() == 0 {
|
||||
return errors.New("at least one query must be specified (format: field=pattern)")
|
||||
}
|
||||
|
||||
return nil
|
||||
return es.Search(conf, args.Slice())
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user