cli icon indicating copy to clipboard operation
cli copied to clipboard

Add EnableBeforeForHelp option to execute Before functions with help flags

Open seipan opened this issue 4 months ago • 0 comments

What type of PR is this?

  • feature

What this PR does / why we need it:

Before functions weren't being executed when users ran --help or -h flags, only when using help commands. This created inconsistent behavior and prevented applications from running setup logic (like language configuration) before displaying help text.

Added EnableBeforeForHelp field to make Before function execution configurable for help flags. When set to true, Before functions run for both help commands and help flags. Defaults to false to maintain backward compatibility.

Which issue(s) this PR fixes:

https://github.com/urfave/cli/issues/2174

Special notes for your reviewer:

non

Testing

Test case for feature.

Release Notes

 Feature: Add EnableBeforeForHelp option to execute Before functions when displaying help via --help/-h flags

seipan avatar Aug 19 '25 14:08 seipan