Skip to content

Commit 53da00d

Browse files
committed
fix: Restore compatibility with Linux with missing hasPrefix
Closes #56
1 parent cbb316a commit 53da00d

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
- All Option-related types now have a flag parameter.
1010
- All constructors have the same constructor arguments order. [#35](https://github.com/kylef/Commander/issues/35)
1111

12+
### Bug Fixes
13+
14+
- Restores compatibility with Linux.
15+
1216
## 0.7.1
1317

1418
### Bug Fixes

Sources/Commander/ArgumentParser.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ public final class ArgumentParser : ArgumentConvertible, CustomStringConvertible
5454
/// Initialises the ArgumentParser with an array of arguments
5555
public init(arguments: [String]) {
5656
self.arguments = arguments.map { argument in
57-
if argument.hasPrefix("-") {
57+
if argument.first == "-" {
5858
let flags = argument[argument.index(after: argument.startIndex)..<argument.endIndex]
5959

60-
if flags.hasPrefix("-") {
60+
if flags.first == "-" {
6161
let option = flags[flags.index(after: flags.startIndex)..<flags.endIndex]
6262
return .option(String(option))
6363
}

0 commit comments

Comments
 (0)