-
Notifications
You must be signed in to change notification settings - Fork 0
CPP-AP: version 3.0.0 #97
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
Merged
Merged
Conversation
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
- Modified the argument parsing logic: Positional arguments consume free values at arbitrary positions in the command-line argument list instead of strictly at the beginning - Added value validation for program name and version setters: values cannot contain whitespaces
1. Combined the `argument::positional<T>` and `argument::optional<T>` classes into one: `argument<ArgT, T>` - `ArgT` is a discriminator value specifying whether the argument is positional or optional - Added generic argument type aliases: `positional_argument<T>` and `optional_argument<T>` 2. Aligned the positional argument implementation to handle the `nargs` parameter 3. Introduced an `none_type` type: - Used as a fallback type for conditional class members or as an argument value type. - Modified the `c_argument_value_type` concept to allow the usage of `none_type` 4. Combined the default argument discriminator types into one: - Previously: `argument::default_positional` and `argument::default_optional` - Currently: `default_argument` - Combined the default argument setter methods of `argument_parser` to match the new structure 5. Modified the `nargs::range` class to always store concrete lower/upper bounds instead of using `std::optional`
- Changed the predefined (default/implicit) value parameter types in the `argument` class to `std::vector<std::any>` - Replaced the current `default_value` and `implicit_value` setter functions with new `default_values` and `implicit_values` functions which accept: - A variadic number of arguments - A `std::ranges::range` type with the value type convertible to the argument's value type - Added a `choices` setter function overload which takes a variadic number of arguments - Add a `default_arguments` function overload which takes a variadic number of arguments
- Replaced `std::unique_ptr` with `std::shared_ptr` in the argument lists within `argument_parser`
- Replaced optional argument reference type with `std::shared_ptr`
- Previously: `std::optional<std::reference_wrapper<std::unique_ptr<argument_base>>>`
- Aligned argument token building to store original (unstripped) command-line values
- Defined a *parsing state* structure within `argument_parser` to replace passing multiple parsing parameters by reference with a single compound type
- Moved the common utility elements to the `util` namespace - Moved the action-related utility elements to the `action::util` namespace - Added a `Utility` group in the documentation output - Added some missing doc comments
- Removed the `AP_UNKNOWN_FLAGS_AS_VALUES` macro support - Introduced the `unknown_policy` discriminator type with the following values: - fail (default): throw an exception when an unknown argument is encountered - warn: issue a warning when an unknown argument is encountered - ignore: ignore unknown arguments - as_values: treat unknown arguments as positional values - Added an `unknown_arguments_policy` method to the `argument_parser` class - Aligned the tokenization and parsing logic to properly handle the new unknown argument flags handling policies - Renamed the `print_config` action and method of `argument_parser` to `print_help` - Changed the value type of the predefined `help` argument from `bool` to `none_type`
- Extended the `argument` class with a `bool _greedy` member (`false` by default) - Added a `greedy(bool)` setter method to the `argument` class. - Aligned the parsing logic to assign all values to a greedy argument (after it's encountered) until its upper `nargs` range is reached
- Added an `argument_group` class with the following attribute setters: - `required` - at least one argument from the group must be used - `mutually_exclusive` - at most one argument from the group can be used - Added an `add_group` method to `argument_parser` - Added new overloads for the `add_optional_argument` and `add_flag` functions with an additional `group` parameter - Aligned the final parsing validation logic to properly verify the requirements of defined argument groups - Removed the `program_name` attribute setter from `argument_parser` and added the `name` parameter to the class constructor to enforce the program name's presence in a parser instance
- Extended the `argument_parser` class with members and functions allowing users to manage subparsers - Aligned the argument parsing functionality: - A parser tries to match the first argument from its input argument range to a subparser - If a match is found, the corresponding subparser is invoked with the remaining arguments - If no match is found, the current parser finalizes parsing arguments - Aligned the argument parsing functionality to allow forward ranges only - Added the `name` and `program_name` attribute accessor functions in `argument_parser` - Restricted the creation of positional arguments to using only one argument name - Added the possibility to bind positional arguments to argument groups - Added an `is_used(arg_name)` method for checking the usage status of an argument - Added an `o_version` default argument which prints the parser's version info - Renamed the `argument_descriptor` class to `help_builder` - Fixed an error where the requirements of all arguments within a mutually exclusive group were verified, which caused unexpected exceptions - Added the `logging_mode` and `ap_git` demo projects
SpectraL519
commented
Sep 26, 2025
d1303d1 to
7b1f600
Compare
SpectraL519
commented
Sep 26, 2025
Owner
Author
SpectraL519
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
- Renamed the `bypass_required` argument attribute to `suppress_arg_checks` - Introduced the `suppress_group_checks` argument attribute - Aligned the tutorial page and documentation comments - Made code cleanup changes
7b1f600 to
0b149fb
Compare
SpectraL519
commented
Sep 26, 2025
Owner
Author
SpectraL519
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
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.
No description provided.