Skip to content

Commit 6ef6363

Browse files
committed
Add linux support
1 parent 0e49462 commit 6ef6363

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

Sources/ArgumentParser.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ public final class ArgumentParser : ArgumentConvertible, CustomStringConvertible
5252
/// Initialises the ArgumentParser with an array of arguments
5353
public init(arguments: [String]) {
5454
self.arguments = arguments.map { argument in
55-
if argument.hasPrefix("-") {
55+
if argument.characters.first == "-" {
5656
let flags = argument[argument.startIndex.successor()..<argument.endIndex]
5757

58-
if flags.hasPrefix("-") {
58+
if flags.characters.first == "-" {
5959
let option = flags[flags.startIndex.successor()..<flags.endIndex]
6060
return .Option(option)
6161
}

Sources/CommandDarwin.swift renamed to Sources/CommandRunner.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
import Darwin.libc
1+
#if os(Linux)
2+
import Glibc
3+
#else
4+
import Darwin.libc
5+
#endif
6+
27

38
/// Extensions to CommandType to provide convinience running methods for CLI tools
49
extension CommandType {

0 commit comments

Comments
 (0)