- Fix compilation errors affecting the unit tests with recent versions of Visual Studio 2022.
- There is a small chance this could affect your code if you were using certain helper functions
defined in the
format_helper.hheader directly (they are otherwise not used outside the unit tests).
- There is a small chance this could affect your code if you were using certain helper functions
defined in the
- Fix the description of the NuGet package.
- This release is NuGet-only and does not contain any other changes. The project version number has not changed; only the NuGet package version.
- Argument parsing
- Added support for a new parsing mode where arguments can have a
separate long name using the
--prefix (customizable, of course) and single-character short name using the-prefix. This allows you to use a parsing style that's similar to POSIX conventions. - You can use functions to define arguments.
- Automatically add a
-Helpargument if not defined, and support easily adding a-Versionargument. - Added the ability to customize error messages and other strings.
- Added support for a new parsing mode where arguments can have a
separate long name using the
- Subcommands
- Renamed "shell commands" to "subcommands" because I never liked the old name.
- Header and class names have been changed accordingly.
- Support commands with custom parsing.
- Easily add a
versionsubcommand. - Set options for all commands using the
command_manager::configure_parser()method, or the[global]block when using code generation. - Subcommand functionality is included by default with
<ookii/command_line.h>, no need for a separate header.
- Renamed "shell commands" to "subcommands" because I never liked the old name.
- Usage help
- Color output support.
- Greatly expanded usage help customization options
with the new
usage_writerclass, including abbreviated syntax, description list ordering and filtering, the ability to override any string or format, and more. - Arguments that have no description but that have other information not shown in the usage syntax (like aliases or a default value) will be included in the description list by default.
line_wrapping_ostreamhas an option to flush all content, including the last unfinished line.- Added
line_wrapping_ostringstreamclass. - Code generation supports the new functionality.
- Updated and improved documentation.
- More samples with descriptions and explanations.
- No longer uses the C++20
<ranges>header because it didn't work in Clang. - Various bug fixes.
There are a number of breaking API changes from version 1.0:
- The callback used by
command_line_parser::on_parsed()takes anstd::optional<std::string_view>for the value, instead of juststd::string_view. - The
command_line_parser::get_argument()method returnsnullptrinstead of throwing an exception for a non-existent argument. - Default values for arguments are now displayed with stream insertion (
operator<<), so custom types must define that instead of a formatter. - The
for_each_argument_in_usage_order()method has been removed; thearguments()method returns the arguments in that order. - The
<shell_command.h>header was renamed to<subcommand.h>.- Recommended: include
<command_line.h>instead; it now includes subcommands.
- Recommended: include
- The
shell_commandclass was renamed tocommand. - The
shell_command_managerclass was renamed tocommand_manager. - Several overloads of the
create_command()andrun_command()methods have been removed. This was necessary to support commands with custom argument parsing. - The
command_manager::run_command()method returns anstd::optional<int>. - Several changes to the code generation scripts mean that any generated files must be regenerated.
- The
OOKII_DECLARE_PARSE_METHOD()macro has been replaced with theOOKII_GENERATED_METHODS()macro.
- Initial release
- Feature parity with Ookii.CommandLine 2.4 for .Net, except for dictionary arguments.