mirror of
https://codeberg.org/scip/esctl.git
synced 2026-08-24 06:34:18 +02:00
add index template completion, index pattern filter and name filter (#95)
This commit is contained in:
@@ -34,6 +34,7 @@ const (
|
||||
Cilm
|
||||
Cnode
|
||||
Cclustersettings
|
||||
Cindextemplate
|
||||
)
|
||||
|
||||
func complete(conf *cfg.Config, cmd *cli.Command, what int) {
|
||||
@@ -65,6 +66,8 @@ func complete(conf *cfg.Config, cmd *cli.Command, what int) {
|
||||
list, err = es.NodeNames(conf)
|
||||
case Cclustersettings:
|
||||
list, err = es.ClusterSettingsNames(conf)
|
||||
case Cindextemplate:
|
||||
list, err = es.IndexTemplateNames(conf)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
|
||||
@@ -49,8 +49,23 @@ func IndexTemplateList(conf *cfg.Config) *cli.Command {
|
||||
Aliases: []string{"ls"},
|
||||
Usage: "list index templates",
|
||||
|
||||
Flags: []cli.Flag{
|
||||
&cli.StringSliceFlag{
|
||||
Name: "filter-index-pattern",
|
||||
Usage: "show only index templates which use patterns, which match the filter",
|
||||
Destination: &conf.Filter,
|
||||
Aliases: []string{"F"},
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "hidden",
|
||||
Usage: "show hidden index templates as well",
|
||||
Destination: &conf.Hidden,
|
||||
Aliases: []string{"H"},
|
||||
},
|
||||
},
|
||||
|
||||
Action: func(ctx context.Context, cmd *cli.Command) error {
|
||||
return es.IndexTemplateList(conf)
|
||||
return es.IndexTemplateList(conf, cmd.Args().Get(0))
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -71,7 +86,7 @@ func IndexTemplateShow(conf *cfg.Config) *cli.Command {
|
||||
},
|
||||
|
||||
ShellComplete: func(ctx context.Context, cmd *cli.Command) {
|
||||
complete(conf, cmd, Cindex)
|
||||
complete(conf, cmd, Cindextemplate)
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -215,7 +230,7 @@ func IndexTemplateDelete(conf *cfg.Config) *cli.Command {
|
||||
},
|
||||
|
||||
ShellComplete: func(ctx context.Context, cmd *cli.Command) {
|
||||
complete(conf, cmd, Cindex)
|
||||
complete(conf, cmd, Cindextemplate)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user