Skip to content

Releases: SpectraL519/cpp-ap

v2.1.0

23 May 11:40
4ebeaf3

Choose a tag to compare

  • Added the argument_parser::verbose function which can be used to set the description verbosity mode
  • Aligned the argument description generating to:
    • Align the argument help messages (when verbose=false)
    • Print the argument parameter values (when verbose=true)
  • Added missing file doc comments

v1.2

13 Mar 15:42

Choose a tag to compare

  • Added the demo workflow
  • Cleanup of the scripts, CMake and workflow files
  • Improved error logic for argument value getting

Fixed the v1.2 tag which addressed an invalid commit hash

v2.0.2

24 Feb 14:11

Choose a tag to compare

Added the argument name verification functionality to the argument_parser class - an error is thrown if argument_parser::add_* is called with a name that:
- is empty
- begins with the flag prefix character
- begins with a digit

v2.0.1

17 Feb 16:43

Choose a tag to compare

  • Doxyfile cleanup
  • Extracted the tutorial and dev notes sections from readme to separate files
  • Added the v2 changelog file
  • Added the documentation workflow
  • Aligned the current workflows to be triggered on PRs to master

v2.0.0

15 Feb 12:51

Choose a tag to compare

The Structure

The v2 version of the library no longer uses a single-header approach, however it is still a header-only library. With this change it is now required to download the entire library - either with CMake or from the releases page.

Range-based Approach

Aligned functions to use a generic range-based approach, which allows for more flexibility in using the library.

Function Description
argument_parser::parse_args(
const AR& argv
)
New
Parses the command-line arguments passed through a range of string-convertible objects.
NOTE: The parse_args(argc, argv) function is still available.
argument::positional::choices(
std::initializer_list<value_type> choices
)
Aligned
Sets the choices parameter of a positional argument.
NOTE: Previously the function used std::vector<value_type>.
argument::positional::choices(
const CR& choices
)
New
Sets the choices parameter of a positional argument using a range of value_type-convertible objects.
argument::optional::choices(
std::initializer_list<value_type> choices
)
Aligned
Sets the choices parameter of an optional argument.
NOTE: Previously the function used std::vector<value_type>.
argument::optional::choices(
const CR& choices
)
New
Sets the choices parameter of an optional argument using a range of value_type-convertible objects.

New Utility Functions

Added utility functions to the argument_parser class that encapsulate common behavior, reducing the need to write boilerplate code and simplifying the argument-parsing logic.

Function Description
void try_parse_args(int argc, char* argv[])
void try_parse_args(const AR& argv)
Parses the command-line arguments and, in case of an error, prints the error message and exits with a failure status.
void handle_help_action()
Checks the value of the help boolean flag argument and exits with success status if the value is true.
T value_or<T, U>(
std::string_view arg_name, U&& default_value
)
Returns the argument's value if possible and default_value otherwise.

A more detailed explanation of these functions is available in the Tutorial section.

v1.1

21 May 18:10

Choose a tag to compare

CPP-AP: version 1.1

  • Introduced CMake integration
  • Formatting scripts improvement
  • Small code refactor including:
    • argument_name class refactor
    • Added aliases for default positional and optional arguments discriminator structures
    • Utilizing the std::ranges library for operations on collections
  • Cleaned the commit history

v1.0

15 May 17:10

Choose a tag to compare

Initial library release