Repository navigation
Releases: oskarirauta/usage_cpp
Releases · oskarirauta/usage_cpp
Release list
v1.7.0
Add nested subcommand support (sub-usage_t per command)
A usage_t may now declare `commands`: a declared-order vector of
{name, shared_ptr<usage_t>}. When the first positional argument matches a
command name, the rest of the command line is handed to that command's own
usage_t and parsed against ITS options (recursively - a sub-usage can have its
own commands). Global options before the command still parse against the parent.
A null entry is a raw passthrough: the command is recognised but its arguments
are left unparsed, retrievable via tail() (for wrapping foreign flag sets like
`docker run`).
shared_ptr keeps usage_t an aggregate, so designated-init (`.args = {...}`) still
works and the sub-usages are released with the parent - no destructor (which
would break the aggregate). args_t gains a default ctor for command usage_t's
whose args are filled on dispatch.
New API: commands member, subcommand()/sub()/tail(). Empty commands == the
previous single-level behaviour, bit for bit (verified). Example + README updated.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ax7adsbWbibrSvpAGr7DTJ
v1.6.1
1.6.1: ordered options, aligned help, version spacing Three fixes to usage/help composition: - options are listed in their declared order. Since 1.5.0 `options` was a std::unordered_map (to drop the tsl::ordered_map dependency) with a "reverse iterate to keep order" routine, but unordered_map has no insertion order, so help listed options in hash order. options is now an ordered std::vector<std::pair<std::string, option_t>>. - the description column is aligned by measuring the widest rendered option first, then padding. The previous up-front width miscounted the key-column padding, so long options ran straight into their descriptions. - the program name is no longer followed by a stray space when version_title starts on a new line (title()/version()). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Oskari Rauta <oskari.rauta@gmail.com>
v1.6.0
release 1.6.0: docs, example version, CI - document positional-argument / remainder handling (options may appear before, after or between positionals; `--` ends option parsing) - bump example + README version strings to 1.6.0 - CI: checkout@v5, push/pull_request triggers, drop the unused submodule step; release workflow uses create-release-action@v2 / upload-recursive-asset-action@v2 (aligned with the splash-drm workflows) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Oskari Rauta <oskari.rauta@gmail.com>
v1.5.0
Release v1.5.0 This release makes usage_cpp independent from other submodules and some minor changes. - instead of tsl::ordered_map, use std::unordered_map - created static functions for manipulating strings to break out from common_cpp depency - implemented `map_contains` since unordered_map does not have `contains` - implemented a routine to reverse iterater unordered_map to keep initialized order of options - remove submodule common_cpp depency Signed-off-by: Oskari Rauta <oskari.rauta@gmail.com>
v1.4.1
Release v1.4.1 minor changes: - improve usage_t::help(), fix some indents Signed-off-by: Oskari Rauta <oskari.rauta@gmail.com>
v1.4.0
Release v1.4.0 Release v1.4.0 is improvement release. New features include: - support for "remainder" options/arguments which works similarly as it does with getopt. Optionally, you can use option "--" to stop parsing and put rest of command-line options to remainder. Remainder is available for user via remainder() function of usage_t class. - Options and arguments are now parsed once during construction of usage_t. - separator = is now supported, for example in example program, you can use `--age 10` or `--age=10` to archieve same result. - arguments for option can now be set to either not used, required or optional. - minimal argument validation is now supported for following types: bool, integer, float, string, hex - info structure has now even more detail. - default function for reporting parsing errors, is now present Signed-off-by: Oskari Rauta <oskari.rauta@gmail.com>
v1.3.0
version bump Signed-off-by: Oskari Rauta <oskari.rauta@gmail.com>
v1.2.0
Release v1.2.0 Some general improvements and better example Signed-off-by: Oskari Rauta <oskari.rauta@gmail.com>
v1.1.0
Release v1.1.0 This release add version_info() Signed-off-by: Oskari Rauta <oskari.rauta@gmail.com>
v1.0.1
Release v1.0.1 - some fine tuning Signed-off-by: Oskari Rauta <oskari.rauta@gmail.com>