Invoke OnUsageError when missing required flags#2161
Merged
dearchap merged 4 commits intourfave:mainfrom Jul 13, 2025
Merged
Conversation
In case of missing required flags, the OnUsageError function will now be invoked instead of directly returning the error.
Juneezee
approved these changes
Jun 24, 2025
Contributor
Author
|
Hi @Juneezee , can you help me with merging this? |
Member
|
@dearchap There seem to be some problems with the CodeQL checks that are preventing the auto-merge. Could you take a quick look when you are available? |
schwarlex
pushed a commit
to la-demos/vcluster-workshop-prep
that referenced
this pull request
Feb 11, 2026
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [github.com/urfave/cli/v3](https://github.com/urfave/cli) | require | minor | `v3.3.8` -> `v3.6.1` | --- ### Release Notes <details> <summary>urfave/cli (github.com/urfave/cli/v3)</summary> ### [`v3.6.1`](https://github.com/urfave/cli/releases/tag/v3.6.1) [Compare Source](urfave/cli@v3.6.0...v3.6.1) #### What's Changed - chore(deps): bump golangci/golangci-lint-action from 8 to 9 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2222](urfave/cli#2222) - feat: add ability to override usage text of default help command by [@​Maks1mS](https://github.com/Maks1mS) in [#​2196](urfave/cli#2196) - Fix:(issue\_2223) Fix incorrect processing of empty value after = by [@​dearchap](https://github.com/dearchap) in [#​2224](urfave/cli#2224) #### New Contributors - [@​Maks1mS](https://github.com/Maks1mS) made their first contribution in [#​2196](urfave/cli#2196) **Full Changelog**: <urfave/cli@v3.6.0...v3.6.1> ### [`v3.6.0`](https://github.com/urfave/cli/releases/tag/v3.6.0) [Compare Source](urfave/cli@v3.5.0...v3.6.0) #### What's Changed - support parallel running of commands by [@​oprudkyi](https://github.com/oprudkyi) in [#​2215](urfave/cli#2215) - Fix:(issue\_2208) Fix local flag by [@​dearchap](https://github.com/dearchap) in [#​2211](urfave/cli#2211) - chore(deps): bump the python-packages group with 2 updates by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2219](urfave/cli#2219) - Call actions on flags set from env by [@​malclocke](https://github.com/malclocke) in [#​2221](urfave/cli#2221) #### New Contributors - [@​malclocke](https://github.com/malclocke) made their first contribution in [#​2221](urfave/cli#2221) **Full Changelog**: <urfave/cli@v3.5.0...v3.6.0> ### [`v3.5.0`](https://github.com/urfave/cli/releases/tag/v3.5.0) [Compare Source](urfave/cli@v3.4.1...v3.5.0) #### What's Changed - Update mkdocs reqs by [@​meatballhat](https://github.com/meatballhat) in [#​2190](urfave/cli#2190) - Allow the user to stop processing flags after seeing N args by [@​adrian-thurston](https://github.com/adrian-thurston) in [#​2163](urfave/cli#2163) - chore(deps): bump github.com/stretchr/testify from 1.10.0 to 1.11.0 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2194](urfave/cli#2194) - chore(deps): bump mkdocs-material from 9.6.16 to 9.6.18 in the python-packages group by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2195](urfave/cli#2195) - chore(deps): bump actions/setup-go from 5 to 6 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2198](urfave/cli#2198) - chore(deps): bump actions/setup-node from 4 to 5 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2199](urfave/cli#2199) - chore(deps): bump actions/setup-python from 5 to 6 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2200](urfave/cli#2200) - chore(deps): bump github.com/stretchr/testify from 1.11.0 to 1.11.1 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2197](urfave/cli#2197) - chore(deps): bump mkdocs-material from 9.6.18 to 9.6.19 in the python-packages group by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2201](urfave/cli#2201) - chore(deps): bump mkdocs-material from 9.6.19 to 9.6.20 in the python-packages group by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2202](urfave/cli#2202) - feat: add name of argument into error message when parsing fails by [@​oprudkyi](https://github.com/oprudkyi) in [#​2203](urfave/cli#2203) - chore(deps): bump mkdocs-material from 9.6.20 to 9.6.21 in the python-packages group by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2204](urfave/cli#2204) - add space between arguments usage by [@​dimfu](https://github.com/dimfu) in [#​2207](urfave/cli#2207) - chore(deps): bump mkdocs-material from 9.6.21 to 9.6.22 in the python-packages group by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2213](urfave/cli#2213) - Fix: Make DefaultText behaviour consistent by [@​dearchap](https://github.com/dearchap) in [#​2214](urfave/cli#2214) #### New Contributors - [@​adrian-thurston](https://github.com/adrian-thurston) made their first contribution in [#​2163](urfave/cli#2163) - [@​oprudkyi](https://github.com/oprudkyi) made their first contribution in [#​2203](urfave/cli#2203) - [@​dimfu](https://github.com/dimfu) made their first contribution in [#​2207](urfave/cli#2207) **Full Changelog**: <urfave/cli@v3.4.1...v3.5.0> ### [`v3.4.1`](https://github.com/urfave/cli/releases/tag/v3.4.1) [Compare Source](urfave/cli@v3.4.0...v3.4.1) #### What's Changed - Use recommended GitHub Actions runner labels by [@​meatballhat](https://github.com/meatballhat) in [#​2181](urfave/cli#2181) - chore(deps): bump actions/checkout from 4 to 5 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​2179](urfave/cli#2179) - Document that `v3` series is recommended for new development by [@​meatballhat](https://github.com/meatballhat) in [#​2186](urfave/cli#2186) **Full Changelog**: <urfave/cli@v3.4.0...v3.4.1> ### [`v3.4.0`](https://github.com/urfave/cli/releases/tag/v3.4.0) [Compare Source](urfave/cli@v3.3.9...v3.4.0) #### What's Changed - Export help display functions as variables to allow custom help display logic by [@​almas-x](https://github.com/almas-x) in [#​2150](urfave/cli#2150) - Invoke OnUsageError when missing required flags by [@​MohitPanchariya](https://github.com/MohitPanchariya) in [#​2161](urfave/cli#2161) - Fix:(issue\_2169) Allow trim space for string slice flags by [@​dearchap](https://github.com/dearchap) in [#​2171](urfave/cli#2171) - Add example of flag groups to docs by [@​jllovet](https://github.com/jllovet) in [#​2178](urfave/cli#2178) - Add installation instructions for gfmrun by [@​jllovet](https://github.com/jllovet) in [#​2177](urfave/cli#2177) - Ensure public vars reference public types by [@​meatballhat](https://github.com/meatballhat) in [#​2180](urfave/cli#2180) #### New Contributors - [@​almas-x](https://github.com/almas-x) made their first contribution in [#​2150](urfave/cli#2150) - [@​MohitPanchariya](https://github.com/MohitPanchariya) made their first contribution in [#​2161](urfave/cli#2161) - [@​jllovet](https://github.com/jllovet) made their first contribution in [#​2178](urfave/cli#2178) **Full Changelog**: <urfave/cli@v3.3.9...v3.4.0> ### [`v3.3.9`](https://github.com/urfave/cli/releases/tag/v3.3.9) [Compare Source](urfave/cli@v3.3.8...v3.3.9) #### What's Changed - Fix typos in documentation for customizations and full API example by [@​amarjit03](https://github.com/amarjit03) in [#​2165](urfave/cli#2165) - Update advanced.md by [@​thetillhoff](https://github.com/thetillhoff) in [#​2170](urfave/cli#2170) #### New Contributors - [@​amarjit03](https://github.com/amarjit03) made their first contribution in [#​2165](urfave/cli#2165) - [@​thetillhoff](https://github.com/thetillhoff) made their first contribution in [#​2170](urfave/cli#2170) **Full Changelog**: <urfave/cli@v3.3.8...v3.3.9> </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4xMjcuMiIsInVwZGF0ZWRJblZlciI6IjQxLjE3My4xIiwidGFyZ2V0QnJhbmNoIjoibWFzdGVyIiwibGFiZWxzIjpbXX0=--> Reviewed-on: https://kubara.git.onstackit.cloud/STACKIT/kubara/pulls/100 Co-authored-by: Matthias_Huether <matthias.huether_ext@external.stackit.cloud> Co-committed-by: Matthias_Huether <matthias.huether_ext@external.stackit.cloud>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
What this PR does / why we need it:
This PR aims to fix the issue noted in #2145
command_run.go-func (cmd *Command) runhas been modified to run theOnUsageErrorfunction when thecheckAllRequiredFlagscheck fails.Which issue(s) this PR fixes:
Fixed #2145