mirror of
https://codeberg.org/scip/esctl.git
synced 2026-08-24 06:24:18 +02:00
more search enhancements (#22)
This commit is contained in:
29
cmd/root.go
29
cmd/root.go
@@ -22,6 +22,7 @@ import (
|
||||
"os"
|
||||
|
||||
"codeberg.org/scip/esctl/pkg/cfg"
|
||||
"codeberg.org/scip/esctl/pkg/es"
|
||||
"codeberg.org/scip/esctl/pkg/log"
|
||||
|
||||
"github.com/urfave/cli/v3"
|
||||
@@ -54,6 +55,12 @@ func Main() int {
|
||||
Sources: cli.EnvVars("ES_DEBUG"),
|
||||
Destination: &conf.Debug,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "debug-http",
|
||||
Value: false,
|
||||
Usage: "enable HTTP debugging",
|
||||
Destination: &conf.DebugHTTP,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "config",
|
||||
Aliases: []string{"c"},
|
||||
@@ -89,6 +96,7 @@ func Main() int {
|
||||
Doc(conf),
|
||||
Repl(conf),
|
||||
Version(conf),
|
||||
Debug(conf),
|
||||
},
|
||||
|
||||
Before: func(ctx context.Context, cmd *cli.Command) (context.Context, error) {
|
||||
@@ -122,3 +130,24 @@ func Version(conf *cfg.Config) *cli.Command {
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func Debug(conf *cfg.Config) *cli.Command {
|
||||
return &cli.Command{
|
||||
Name: "debug",
|
||||
Usage: "developer only",
|
||||
|
||||
Flags: []cli.Flag{
|
||||
&cli.StringFlag{
|
||||
Name: "index",
|
||||
Usage: "index to search within",
|
||||
Sources: cli.EnvVars("ES_INDEX"),
|
||||
Destination: &conf.Index,
|
||||
Aliases: []string{"i"},
|
||||
},
|
||||
},
|
||||
|
||||
Action: func(ctx context.Context, cmd *cli.Command) error {
|
||||
return es.Debug(conf)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user