diff --git a/gcli.go b/gcli.go index 6c9a808..d0beebd 100644 --- a/gcli.go +++ b/gcli.go @@ -77,6 +77,9 @@ type Flags = gflag.Flags // FlagMeta alias of the gflag.Option type FlagMeta = gflag.Option +// FlagsConfig alias of the gflag.FlagsConfig +type FlagsConfig = gflag.FlagsConfig + // NewFlags create new gflag.Flags func NewFlags(nameWithDesc ...string) *gflag.Flags { return gflag.New(nameWithDesc...) diff --git a/gflag/flags.go b/gflag/flags.go index 98ef913..626a79d 100644 --- a/gflag/flags.go +++ b/gflag/flags.go @@ -746,14 +746,11 @@ func (fs *Flags) formatOneFlag(f *flag.Flag) (s string) { // --- build description if desc == "" { desc = defaultDesc + } else { + desc = strings.Replace(strutil.UpperFirst(desc), "\n", nlIndent, -1) } - // flag is required - if meta.Required { - s = "*" + s - } - - s += strings.Replace(strutil.UpperFirst(desc), "\n", nlIndent, -1) + s += getRequiredMark(meta.Required) + desc // ---- append default value if isZero, isStr := cflag.IsZeroValue(f, f.DefValue); !isZero {