diff --git a/src/go/pt-galera-log-explainer/main.go b/src/go/pt-galera-log-explainer/main.go index bc177900..81c1a404 100644 --- a/src/go/pt-galera-log-explainer/main.go +++ b/src/go/pt-galera-log-explainer/main.go @@ -70,20 +70,14 @@ func main() { utils.SkipColor = CLI.NoColor - var paths []string - switch kongcli.Command() { - case "list ": - paths = CLI.List.Paths - case "ctx ": - paths = CLI.Ctx.Paths - case "conflicts ": - paths = CLI.Conflicts.Paths - } - - if !CLI.PxcOperator && !CLI.SkipOperatorDetection && areOperatorFiles(paths) { - CLI.PxcOperator = true - log.Info().Msg("Detected logs coming from Percona XtraDB Cluster Operator, enabling --pxc-operator") - + for _, path := range kongcli.Path { + if path.Positional != nil && path.Positional.Name == "paths" { + paths, ok := path.Positional.Target.Interface().([]string) + if ok && !CLI.PxcOperator && !CLI.SkipOperatorDetection && areOperatorFiles(paths) { + CLI.PxcOperator = true + log.Info().Msg("Detected logs coming from Percona XtraDB Cluster Operator, enabling --pxc-operator") + } + } } translate.AssumeIPStable = !CLI.PxcOperator