Allow user-defined options to shadow implicit ones (--help, --version)#159
Merged
Allow user-defined options to shadow implicit ones (--help, --version)#159
--help, --version)#159Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR enables user-defined options to override the implicit "--help" and "--version" options by renaming the implicit options and updating their inclusion logic.
- Rename “HelpOption” and “VersionOption” to “ImplicitHelpOption” and “ImplicitVersionOption” respectively.
- Update the command schema logic to conditionally include implicit options based on whether a command explicitly defines them.
- Update tests to verify both the positive and negative binding scenarios with the new implicit options.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| CliFx/Schema/OptionSchema.cs | Renamed static properties to better reflect their implicit usage. |
| CliFx/Schema/CommandSchema.cs | Modified logic to include implicit options only when not overridden by command-defined options. |
| CliFx/Input/OptionInput.cs | Updated option checks to use implicit options. |
| CliFx/CliApplication.cs | Adjusted help and version option checks to match the renamed properties. |
| CliFx.Tests/OptionBindingSpecs.cs | Added tests for binding when using identifiers that match implicit options. |
| CliFx.Tests/HelpTextSpecs.cs | Updated test names and behaviors to validate the new implicit option behavior. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #159 +/- ##
==========================================
+ Coverage 92.89% 92.91% +0.01%
==========================================
Files 84 84
Lines 2279 2285 +6
Branches 336 339 +3
==========================================
+ Hits 2117 2123 +6
Misses 94 94
Partials 68 68 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This was referenced Jul 26, 2025
This was referenced Nov 19, 2025
This was referenced Dec 13, 2025
Closed
This was referenced Dec 27, 2025
Closed
This was referenced Jan 10, 2026
This was referenced Jan 17, 2026
Closed
This was referenced Jan 24, 2026
Closed
This was referenced Jan 31, 2026
Closed
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.
Closes #156