Skip to content

feat(cli): Add service command version dispatch#1848

Merged
gtema merged 1 commit into
mainfrom
claude/openstack-cli-version-dispatch-81l1nz
Jul 13, 2026
Merged

feat(cli): Add service command version dispatch#1848
gtema merged 1 commit into
mainfrom
claude/openstack-cli-version-dispatch-81l1nz

Conversation

@gtema

@gtema gtema commented Jul 13, 2026

Copy link
Copy Markdown
Owner

Each crate's wrapper type now hand-implements clap::Args and
clap::FromArgMatches (the pattern clap itself documents in
examples/derive_ref/hand_subcommand.rs and flatten_hand_args.rs)
instead of deriving Parser over a trailing_var_arg capture. A small
shared resolve_api_version() helper in cli/core scans the real process
args once to decide which version's subcommand tree to merge into the
single Command clap builds; from_arg_matches then reads the
clap-parsed (env/default-aware) value to pick the matching variant.
Since there is only ever one tree now, GlobalOpts (flattened once, as
before, on the top-level Cli) is naturally visible in --help
everywhere, with no per-crate duplication.

Assisted-By: Claude Sonnet 5 noreply@anthropic.com
Signed-off-by: Artem Goncharov artem.goncharov@gmail.com

@gtema
gtema force-pushed the claude/openstack-cli-version-dispatch-81l1nz branch 2 times, most recently from 2a22ab9 to 69f65cc Compare July 13, 2026 13:29
Each crate's wrapper type now hand-implements clap::Args and
clap::FromArgMatches (the pattern clap itself documents in
examples/derive_ref/hand_subcommand.rs and flatten_hand_args.rs)
instead of deriving Parser over a trailing_var_arg capture. A small
shared resolve_api_version() helper in cli/core scans the real process
args once to decide which version's subcommand tree to merge into the
single Command clap builds; from_arg_matches then reads the
clap-parsed (env/default-aware) value to pick the matching variant.
Since there is only ever one tree now, GlobalOpts (flattened once, as
before, on the top-level Cli) is naturally visible in --help
everywhere, with no per-crate duplication.

Assisted-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: Artem Goncharov <artem.goncharov@gmail.com>
@gtema
gtema force-pushed the claude/openstack-cli-version-dispatch-81l1nz branch from 69f65cc to 54b7ebd Compare July 13, 2026 13:40
@gtema
gtema merged commit e0ef85c into main Jul 13, 2026
20 checks passed
@gtema-release-plz gtema-release-plz Bot mentioned this pull request Jul 13, 2026
@gtema
gtema deleted the claude/openstack-cli-version-dispatch-81l1nz branch July 14, 2026 07:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant