You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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