Skip to content

Commit

Permalink
flagutil: rename helper func
Browse files Browse the repository at this point in the history
  • Loading branch information
gobwas committed Sep 5, 2020
1 parent 6cb37cc commit c8899d4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions flagutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func Parse(ctx context.Context, flags *flag.FlagSet, opts ...ParseOption) (err e

if err = p.Parse(ctx, fs); err != nil {
if err == flag.ErrHelp {
_ = printUsage(ctx, &c, flags)
_ = printUsageMaybe(ctx, &c, flags)
}
if err != nil {
err = fmt.Errorf("flagutil: parse error: %w", err)
Expand All @@ -102,7 +102,7 @@ func PrintDefaults(ctx context.Context, flags *flag.FlagSet, opts ...ParseOption
return printDefaults(ctx, &c, flags)
}

func printUsage(ctx context.Context, c *config, flags *flag.FlagSet) error {
func printUsageMaybe(ctx context.Context, c *config, flags *flag.FlagSet) error {
if !c.customUsage && flags.Usage != nil {
flags.Usage()
return nil
Expand Down

0 comments on commit c8899d4

Please sign in to comment.