Skip to content

Commit

Permalink
chore: fix example run error and cmd help message error
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Sep 29, 2022
1 parent 7a02863 commit 4243004
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
3 changes: 3 additions & 0 deletions gcli.go
Original file line number Diff line number Diff line change
Expand Up @@ -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...)
Expand Down
9 changes: 3 additions & 6 deletions gflag/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "<red>*</>" + 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 {
Expand Down

0 comments on commit 4243004

Please sign in to comment.