The debug command broke for the get subcommand. This is due to PersistentPreRun only traversing one level of subcommands. This is a known issue with cobra
Zookeeper get commands broke. This commit closes the adminclient before the function returns with the defer command, which is not what we want to do. We must keep the adminclient open until the end of the command so this PR reverts that commit which added the buggy getCliRunnerAndCtx function
Verification:
Debug flag fix
Before:
go run cmd/topicctl/main.go get topics --cluster-config examples/local-cluster/cluster.yaml --debug
[2023-09-18 08:55:33] INFO Topics:
-------+------------+-------------+-----------+------------
NAME | PARTITIONS | REPLICATION | RETENTION | RACKS
| | | MINS | (MIN,MAX)
-------+------------+-------------+-----------+------------
-------+------------+-------------+-----------+------------
After:
$ go run cmd/topicctl/main.go get topics --cluster-config examples/local-cluster/cluster.yaml --debug
[2023-09-18 08:55:29] DEBUG No ZK addresses provided, using broker admin client
[2023-09-18 08:55:29] DEBUG Connecting to cluster on address localhost:9092 with TLS enabled=false, SASL enabled=false
[2023-09-18 08:55:29] DEBUG Getting supported API versions
...
https://github.com/segmentio/topicctl/pull/148 introduced two new (known) bugs that are fixed in this PR:
getCliRunnerAndCtx
functionVerification:
Before:
After:
Before:
After: