Skip to content

clap compatibility

This matrix describes compatibility with clap 4.6.6 and clap_derive 4.6.4, the versions audited in this workspace. It distinguishes what a CLI can declare directly with usage from what clap_usage can recover from an existing clap::Command.

The bridge is not a lossless migration verifier. clap exposes some settings only through setters, so clap_usage cannot detect that they were present. Migrate from the Rust declaration, not only from generated KDL, when a row says usage only.

Status

StatusMeaning
SupportedThe derive, compiled parser, spec, and reference parser carry the behavior.
Usage onlyA usage declaration carries it, but clap exposes no getter or the bridge loses part of it.
PartialThe common form works; the note names the unsupported part.
Differentusage intentionally has different parsing behavior.
UnsupportedNo equivalent is available yet.
Non-goalThe API shape is outside the static-parser architecture.

Types and declarations

clapusageclap → specNotes
ParserSupportedSupported#[derive(usage::Cli)]
ArgsSupportedSupported#[derive(usage::Args)], including flatten
SubcommandSupportedSupportedNested and boxed variants are supported.
ValueEnumPartialPartialBare values and names work; aliases, hidden values, per-value help, and case-insensitive matching do not.
#[arg(skip)]SupportedNot applicable#[usage(skip)]; skipped fields do not belong in a spec.
arbitrary Command / Arg builder codeNon-goalPartialusage-lib is the dynamic spec interpreter; usage derive does not reproduce clap's builder API.
ArgMatches, FromArgMatches, CommandFactoryNon-goalNot applicableTyped structs are built directly from static tables.
update_from / try_update_fromUnsupportedNot applicableA parse currently constructs a new value.

Arguments and values

clapusageclap → specNotes
long and short flagsSupportedSupportedMultiple visible aliases are supported. Hidden flag aliases are bridge-lossy.
positional argumentsSupportedSupportedRequired, optional, and variadic positionals are supported.
Option<T>, Vec<T>, Option<Vec<T>>SupportedNot applicableValues use FromStr; Unix PathBuf and OsString also accept non-UTF-8 bytes.
ArgAction::SetTrue, SetFalse, CountSupportedSupportedSetFalse is #[usage(negate)].
default_valueSupportedSupportedDefaults are applied after argv and environment values.
default_missing_valueUsage onlyUnsupported#[usage(default_missing = "…")]; clap has no getter.
default_value_if(s)Usage onlyUnsupported#[usage(default_if(...))]; clap has no getter.
envSupportedPartialEnvironment fallback works, but the current bridge can lose the binding.
value_delimiterSupportedSupportedASCII delimiters round-trip.
num_argsPartialPartialvar_min / var_max cover ranges; fixed arity, distinct value names, and bridge preservation remain incomplete.
allow_hyphen_valuesSupportedSupportedAvailable on value-taking flags; trailing positionals use double_dash = "automatic".
allow_negative_numbersUnsupportedUnsupportedallow_hyphen_values is broader, not equivalent.
require_equalsSupportedSupportedDetached values are refused.
value_terminatorUnsupportedUnsupportedNo spec spelling yet.
dont_delimit_trailing_valuesUnsupportedUnsupportedNo spec spelling yet.
possible-values parserSupportedSupportedUse ValueEnum or choices.
arbitrary value_parser / numeric rangesUnsupportedUnsupportedFromStr validates conversion, but there is no per-field validator or declarative range yet.
ValueHintPartialPartialPath hints used by completions work; the full clap vocabulary does not.

Relationships and command routing

clapusageclap → specNotes
required, conflicts_with, overrides_withSupportedSupportedEnvironment values participate in post-binding checks.
requiresUsage onlyUnsupportedclap exposes setters but no getter.
requires_if(s)Usage onlyUnsupportedPresence and value-conditional forms are supported in usage.
required_if_eq, required_unless_presentPartialPartialCommon single-selector forms work; the complete all/any families do not.
ArgGroup, required groups, exclusiveSupportedSupportedPositional group members are not represented yet.
positional conflicts and relationshipsUnsupportedUnsupportedSpec selectors currently name flags.
global flagsSupportedSupportedA global may occur once per selected command scope.
allow_external_subcommandsSupportedSupportedUse an #[usage(external_subcommand)] catch-all variant.
multicallSupportedSupportedparse() routes on the executable basename.
no_binary_nameUnsupportedUnsupportedLow-level usage-argv already receives argv without argv0; no clap-compatible setter exists.
infer_subcommands, infer_long_argsUnsupportedUnsupportedDiagnostics suggest likely names but do not accept prefixes.
arg_required_else_help and subcommand/argument policiesUnsupportedUnsupportedNo command-policy vocabulary yet.
unknown flagsDifferentDifferentThe spec can choose strict errors; the reference parser may forward unknown flag-like data to positionals.

Help, version, and generated artifacts

clapusageclap → specNotes
short and long helpSupportedSupportedThe compiled renderer is checked against usage-lib across the jdx CLI fleet.
help headingsSupportedSupportedFlags and arguments are grouped by heading.
hidden commands, flags, and argumentsSupportedSupportedGranular hides for defaults, env, and possible values are unsupported.
doc comments and long helpSupportedSupportedFirst paragraph is short help; the full block is long help.
verbatim_doc_commentUnsupportedNot applicableDoc comments are normalized.
help_template, next_line_help, flatten_helpUnsupportedUnsupportedNo equivalent yet.
term_width, max_term_widthUnsupportedUnsupportedHelp wraps using COLUMNS.
help styles and colorPartialUnsupportedDiagnostics are styled; help output is not.
built-in help/version flag controlUnsupportedUnsupportedCustom help/version actions and disabling built-ins are not represented.
--version / -VSupportedSupportedVersion propagation is supported.
completionsPartialSupportedSelf-contained bash, fish, PowerShell, and zsh scripts are available; Elvish is not.
KDL, markdown, and manpagesSupportedSupportedEmitted KDL feeds the existing generators without a runtime dependency.

Usage extensions

These are not clap compatibility gaps. usage additionally supports mount, restart_token, default_subcommand, command and flag effect, Nushell completions, and a language-neutral conformance corpus. clap cannot express those properties, so a clap-generated spec cannot carry them without an overlay.

This page is the compatibility baseline, not a claim that every clap builder method is covered. When clap is updated, audit new public derive attributes and relevant Command, Arg, and PossibleValue methods here before treating the update as migration-neutral.

MIT LicenseCopyright © 2026jdx.dev