Apply hooks to default values.

This commit is contained in:
Alec Thomas
2018-09-20 18:16:45 +10:00
parent 54338bd8b1
commit 6fa83bdc0e
7 changed files with 107 additions and 35 deletions
+14
View File
@@ -13,6 +13,20 @@ const (
defaultColumnPadding = 4
)
// Help flag.
type helpValue bool
func (h helpValue) BeforeApply(ctx *Context) error {
options := ctx.Kong.helpOptions
options.Summary = false
err := ctx.Kong.help(options, ctx)
if err != nil {
return err
}
ctx.Kong.Exit(1)
return nil
}
// HelpOptions for HelpPrinters.
type HelpOptions struct {
// Don't print top-level usage summary.