Export funcs to configure flag prefix/env hints

This will allow users to customize the prefix section or env hint
section of the flag entries in the help menu without having to
reimplement the rest of the logic required in defining FlagStringer.
This commit is contained in:
rliebz
2017-08-26 07:42:25 -04:00
committed by Robert Liebowitz
parent 7fb9c86b14
commit 11d45572f9
2 changed files with 22 additions and 6 deletions

View File

@@ -26,3 +26,11 @@ type OnUsageErrorFunc func(context *Context, err error, isSubcommand bool) error
// FlagStringFunc is used by the help generation to display a flag, which is
// expected to be a single line.
type FlagStringFunc func(Flag) string
// FlagNamePrefixFunc is used by the default FlagStringFunc to create prefix
// text for a flag's full name.
type FlagNamePrefixFunc func(fullName, placeholder string) string
// FlagEnvHintFunc is used by the default FlagStringFunc to annotate flag help
// with the environment variable details.
type FlagEnvHintFunc func(envVar, str string) string