Fix bug in main.arguments

Process.arguments is never empty as the first item is always the path of the script.
Except for in a playground where it actually is empty.
This commit is contained in:
Kare Morstol
2015-09-17 01:36:23 +02:00
parent 04a1e03e7a
commit 32d68a329d
+2 -1
View File
@@ -52,7 +52,8 @@ public final class MainShellContext: ShellContextType {
}
}
public lazy var arguments: [String] = Process.arguments.isEmpty ? [] : Array(Process.arguments.dropFirst())
public lazy var arguments: [String] = Process.arguments.count <= 1 ? [] : Array(Process.arguments.dropFirst())
public lazy var name: String = Process.arguments.first.map(NSURL.init)?.lastPathComponent ?? ""
private init() {