add "cluster ls", put "status" into "cluster status" (#5)

This commit is contained in:
T. von Dein
2026-04-28 13:43:13 +02:00
parent 3cbc67567b
commit f27f9157fb
8 changed files with 115 additions and 95 deletions

View File

@@ -34,6 +34,49 @@ func Cluster(conf *cfg.Config) *cli.Command {
Commands: []*cli.Command{
Compare(conf),
Status(conf),
List(conf),
},
}
}
func List(conf *cfg.Config) *cli.Command {
return &cli.Command{
Name: "list",
Usage: "list configured clusters",
Aliases: []string{"ls"},
Action: func(ctx context.Context, cmd *cli.Command) error {
if err := es.List(conf); err != nil {
return err
}
return nil
},
}
}
func Status(conf *cfg.Config) *cli.Command {
return &cli.Command{
Name: "status",
Usage: "show cluster status",
Aliases: []string{"s"},
Flags: []cli.Flag{
&cli.BoolFlag{
Name: "all",
Usage: "show status of all clusters",
Destination: &conf.All,
Aliases: []string{"a"},
},
},
Action: func(ctx context.Context, cmd *cli.Command) error {
if err := es.Status(conf); err != nil {
return err
}
return nil
},
}
}