Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call FlagStringer in String() method of slice flags #1508

Merged
merged 2 commits into from Oct 6, 2022

Commits on Sep 30, 2022

  1. Call FlagStringer in String() method of slice flags

    The default help template relies on the String() method of Flag
    to render the flag. For most flag types, String() indirects through
    FlagStringer, so that is the best place to customize flag rendering.
    
    FlagStringer was not called for slice flags because their help output
    differs from other flags in two ways: there can be multiple default
    values, and the flag name is shown two times to indicate that the flag
    can be specified multiple times.
    
    To make multiple values work in the FlagStringer, I simply changed
    GetValue() to return all values.
    
    Showing the flag more than once is achieved through a new interface,
    DocGenerationSliceFlag, which the FlagStringer uses to decide whether
    the flag is a slice flag type.
    fjl committed Sep 30, 2022
    Copy the full SHA
    72cbb3d View commit details
    Browse the repository at this point in the history

Commits on Oct 5, 2022

  1. Copy the full SHA
    5ff1c8d View commit details
    Browse the repository at this point in the history