apple / apple/swift-argument-parser

`title` argument passed to nested `@OptionGroup` has no effect

Open
#558 3 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Swift
Stars
3.8k
Forks
411
Avg merge
7d 14h
Merged PRs (30d)
15

Description

`@OptionGroup` behaves in an unexpected way with nested groups when `title:` argument value is specified.

**ArgumentParser version:** 1.2.2
**Swift version:**
swift-driver version: 1.62.15 Apple Swift version 5.7.2 (swiftlang-5.7.2.135.5 clang-1400.0.29.51)
Target: arm64-apple-macosx13.0

### Checklist
- [x] If possible, I've reproduced the issue using the `main` branch of this package
- [x] I've searched for [existing GitHub issues](https://github.com/apple/swift-argument-parser/issues)

### Steps to Reproduce
Create a type that has properties using `@OptionGroup` property wrapper with `title:` argument passed. Uses this type then as `@OptionGroup` itself. This top level may specify or not specify its own `title:` argument, this doesn't make a difference on the observed outcome.

### Expected behavior
Nested `@OptionGroup`s have their `title:` values displayed and options grouped by these titles in help output.

### Actual behavior
Nested `@OptionGroup`s don't have their `title:` values displayed and options grouped by these titles in help output. All of the options are displayed within the top-level group, `title:` values on nested groups have no effect whatsoever.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the nested @OptionGroup case from the issue and inspect the @OptionGroup help-output and grouping entry points. Trace how nested title values are propagated, then verify that each nested group appears under its own title while top-level grouping still works.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.