From 7a8d285ce3aaf35b973fa5c30635c19aa3702b64 Mon Sep 17 00:00:00 2001
From: default <216188+jdx@users.noreply.github.com>
Date: Thu, 20 Aug 2026 06:14:30 +0000
Subject: [PATCH 1/4] feat(parse): support optional flag values
---
PLAN.md | 4 +
argv/src/lib.rs | 116 ++++++++++++++++++++---
argv/src/spec.rs | 3 +
conformance/src/tables.rs | 1 +
conformance/tests/optional_flag_value.rs | 35 +++++++
derive/src/codegen.rs | 38 ++++++++
derive/src/model.rs | 44 ++++++++-
docs/rust/args-and-flags.md | 5 +
docs/rust/clap-compatibility.md | 52 +++++-----
docs/rust/index.md | 4 +-
docs/spec/reference/flag.md | 11 +++
lib/src/parse.rs | 93 ++++++++++++++++--
lib/src/spec/arg.rs | 9 +-
lib/src/spec/builder.rs | 6 ++
lib/src/spec/flag.rs | 65 ++++++++++++-
usage-rs/tests/facade.rs | 47 +++++++++
16 files changed, 473 insertions(+), 60 deletions(-)
diff --git a/PLAN.md b/PLAN.md
index 251958e50..e84764d1f 100644
--- a/PLAN.md
+++ b/PLAN.md
@@ -514,6 +514,10 @@ Groups are the opposite case: `Command::get_groups`, `ArgGroup::get_args` and
errors. KDL, usage-lib, the typed derive/static metadata, generated Go, and the
clap bridge carry the policy. Repeatable, variadic, and count flags retain their
collecting behavior.
+- [x] **Optional flag values.** `Option