Cobra 1.6 has modified its default help template. This breaks cobrautil which needs to manipulate the original string.
This has come up when trying to upgrade to Cobra 1.6 in Tanzu Framework where we get the error:
panic: Expected to find available commands section in spf13/cobra default usage template
Cobra 1.6 has modified its default help template. This breaks cobrautil which needs to manipulate the original string. This has come up when trying to upgrade to Cobra 1.6 in Tanzu Framework where we get the error:
The problematic code is: https://github.com/cppforlife/cobrautil/blob/d60711905d65368620738bff69dcd0ee84c3f69c/help_sections.go#L36-L43
The change to Cobra can be seen here: https://github.com/spf13/cobra/commit/2169adb5749372c64cdd303864ae8a444da6350f#diff-4d7d1923693fc5ce892add2ea2907a744e77ea0b50c1939ccc5067cb48a466a3L514 and was part of https://github.com/spf13/cobra/pull/1003
I'll post a PR