Merge pull request #889 from cli/hacky-help
Fix the help docs on subcommands
This commit is contained in:
commit
a7cef60aae
1 changed files with 7 additions and 0 deletions
|
|
@ -28,6 +28,7 @@ var Version = "DEV"
|
|||
var BuildDate = "" // YYYY-MM-DD
|
||||
|
||||
var versionOutput = ""
|
||||
var cobraDefaultHelpFunc func(*cobra.Command, []string)
|
||||
|
||||
func init() {
|
||||
if Version == "DEV" {
|
||||
|
|
@ -51,6 +52,7 @@ func init() {
|
|||
// TODO:
|
||||
// RootCmd.PersistentFlags().BoolP("verbose", "V", false, "enable verbose output")
|
||||
|
||||
cobraDefaultHelpFunc = RootCmd.HelpFunc()
|
||||
RootCmd.SetHelpFunc(rootHelpFunc)
|
||||
|
||||
RootCmd.SetFlagErrorFunc(func(cmd *cobra.Command, err error) error {
|
||||
|
|
@ -249,6 +251,11 @@ func determineBaseRepo(cmd *cobra.Command, ctx context.Context) (ghrepo.Interfac
|
|||
}
|
||||
|
||||
func rootHelpFunc(command *cobra.Command, s []string) {
|
||||
if command != RootCmd {
|
||||
cobraDefaultHelpFunc(command, s)
|
||||
return
|
||||
}
|
||||
|
||||
type helpEntry struct {
|
||||
Title string
|
||||
Body string
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue