apple / apple/swift-argument-parser

--opt= silently collapses to a bare flag and consumes the following token (short -o= behaves differently)

Closed Beginner friendly
#958 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Swift
Stars
3.8k
Forks
411
Avg merge
7d 14h
Merged PRs (30d)
15

Description

## Description

`ParsedArgument.init(_:)` (`Sources/ArgumentParser/Parsing/SplitArguments.swift`, ~lines 21–31) collapses an empty value after `=` into a bare flag:

```swift
let indexOfEqualSign = str.firstIndex(of: "=") ?? str.endIndex
let (baseName, value) = (str[..

Contributor guide

Open the contributing guide

Research direction

Start in Sources/ArgumentParser/Parsing/SplitArguments.swift, especially ParsedArgument.init(_:) around lines 21–31 and the short-option handling around lines 743–750. Trace parseIndividualArg and popNextElementIfValue(after:), then add regression coverage for ["--out=", "file.txt"] and ["-o=", "file.txt"]. Done means both forms preserve an explicitly empty value and leave file.txt positional.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
75/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.