swiftlang/swift-package-manager

[SR-7831] `ArgumentParser` parses short option and option-argument without delimiting space as a single (likely unrecognised) option

Open

#4.800 geöffnet am 31. Mai 2018

Auf GitHub ansehen
 (6 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)Swift (1.462 Forks)batch import
buggood first issue

Repository-Metriken

Stars
 (10.145 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 9T 13h) (90 gemergte PRs in 30 T)

Beschreibung

Previous ID SR-7831
Radar rdar://problem/36340481
Original Reporter @aciidb0mb3r
Type Bug
Votes 0
Component/s Package Manager
Labels Bug, StarterBug
Assignee None
Priority Medium

md5: 96d5acc7cd3ec4326fc64597be212962

Issue Description:

`ArgumentParser` parses short option and option-argument without delimiting space as a single (likely unrecognised) option.

For example, if an option is added to the parser with a short name of `-n`, `ArgumentParser` parses `-n 2` as the “n” option with “2” as its option-argument.

But it parses `-n2` as the unknown option `n2`.

Where long options are prefixed with `--`, it is common for CLI to treat `-n2` and `-n 2` identically.

This probably also implies `ArgumentParser` doesn’t handle adjoining flags (e.g. parsing `-abc` identically to `-a -b -c`) — but I haven’t tested this.

Contributor Guide