Skip to content

Conversation

@SpectraL519
Copy link
Owner

No description provided.

- 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
Copy link
Owner Author

@SpectraL519 SpectraL519 left a 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
Copy link
Owner Author

@SpectraL519 SpectraL519 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@SpectraL519 SpectraL519 merged commit 16f8f5a into master Sep 26, 2025
16 checks passed
@SpectraL519 SpectraL519 deleted the cpp-ap-v3 branch September 26, 2025 21:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants