From 02b93bc4eccf3552f9f860ee2d2ef597dd778810 Mon Sep 17 00:00:00 2001 From: Kare Morstol Date: Tue, 22 Mar 2016 11:56:20 +0100 Subject: [PATCH] Update to Swift 2.2: replace __X__ with #X. --- .swift-version | 2 +- Sources/SwiftShell/Bash.swift | 4 ++-- Sources/SwiftShell/Command.swift | 14 +++++++------- Sources/SwiftShell/General/Lazy-split.swift | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.swift-version b/.swift-version index 879b416..8bbe6cf 100644 --- a/.swift-version +++ b/.swift-version @@ -1 +1 @@ -2.1 +2.2 diff --git a/Sources/SwiftShell/Bash.swift b/Sources/SwiftShell/Bash.swift index 0e58ec8..6015054 100644 --- a/Sources/SwiftShell/Bash.swift +++ b/Sources/SwiftShell/Bash.swift @@ -21,7 +21,7 @@ extension ShellRunnable { - parameter bashcommand: the bash shell command. - returns: standard output and standard error in one string, trimmed of whitespace and newline if it is single-line. */ - public func run (bash bashcommand: String, file: String = __FILE__, line: Int = __LINE__) -> String { + public func run (bash bashcommand: String, file: String = #file, line: Int = #line) -> String { return outputFromRun(createTask(bash: bashcommand), file: file, line: line) } @@ -54,7 +54,7 @@ Shortcut for bash shell command, returns output and errors as a String. - parameter bashcommand: the bash shell command. - returns: standard output and standard error in one string, trimmed of whitespace and newline if it is single-line. */ -public func run (bash bashcommand: String, file: String = __FILE__, line: Int = __LINE__) -> String { +public func run (bash bashcommand: String, file: String = #file, line: Int = #line) -> String { return main.run(bash: bashcommand, file: file, line: line) } diff --git a/Sources/SwiftShell/Command.swift b/Sources/SwiftShell/Command.swift index 5b2e563..e3bd95d 100644 --- a/Sources/SwiftShell/Command.swift +++ b/Sources/SwiftShell/Command.swift @@ -14,7 +14,7 @@ Print message to standard error and halt execution. - parameter errorcode: exit code for the entire program. Defaults to 1. - returns: not. */ -@noreturn public func exit (errormessage errormessage: T, errorcode: Int32 = EXIT_FAILURE, file: String = __FILE__, line: Int = __LINE__) { +@noreturn public func exit (errormessage errormessage: T, errorcode: Int32 = EXIT_FAILURE, file: String = #file, line: Int = #line) { main.stderror.write(file + ":\(line): ") main.stderror.writeln(errormessage) exit(errorcode) @@ -26,7 +26,7 @@ Print error to standard error and halt execution. - parameter error: the error - returns: not. */ -@noreturn public func exit (error: ErrorType, file: String = __FILE__, line: Int = __LINE__) { +@noreturn public func exit (error: ErrorType, file: String = #file, line: Int = #line) { if let shellerror = error as? ShellError { exit(errormessage: shellerror, errorcode: shellerror.errorcode, file: file, line: line) } else { @@ -193,7 +193,7 @@ extension ShellRunnable { - parameter args: the arguments, one string for each. - returns: standard output and standard error in one string, trimmed of whitespace and newline if it is single-line. */ - public func run (executable: String, _ args: Any ..., file: String = __FILE__, line: Int = __LINE__) -> String { + public func run (executable: String, _ args: Any ..., file: String = #file, line: Int = #line) -> String { let stringargs = args.flatten().map { String($0) } return outputFromRun(createTask(executable, args: stringargs), file: file, line: line) } @@ -208,7 +208,7 @@ public struct AsyncShellTask { public let stderror: ReadableStream private let task: NSTask - init (task: NSTask, file: String = __FILE__, line: Int = __LINE__) { + init (task: NSTask, file: String = #file, line: Int = #line) { self.task = task let outpipe = NSPipe() @@ -253,7 +253,7 @@ extension ShellRunnable { - parameter args: Arguments to the executable. - returns: An AsyncShellTask with standard output, standard error and a 'finish' function. */ - public func runAsync (executable: String, _ args: Any ..., file: String = __FILE__, line: Int = __LINE__) -> AsyncShellTask { + public func runAsync (executable: String, _ args: Any ..., file: String = #file, line: Int = #line) -> AsyncShellTask { let stringargs = args.flatten().map { String($0) } return AsyncShellTask(task: createTask(executable, args: stringargs), file: file, line: line) } @@ -289,7 +289,7 @@ Shortcut for shell command, returns output and errors as a String. - parameter args: the arguments, one string for each. - returns: standard output and standard error in one string, trimmed of whitespace and newline if it is single-line. */ -public func run (executable: String, _ args: Any ..., file: String = __FILE__, line: Int = __LINE__) -> String { +public func run (executable: String, _ args: Any ..., file: String = #file, line: Int = #line) -> String { return main.run(executable, args, file: file, line: line) } @@ -300,7 +300,7 @@ Run executable and return before it is finished. - parameter args: arguments to the executable. - returns: an AsyncShellTask with standard output, standard error and a 'finish' function. */ -public func runAsync (executable: String, _ args: Any ..., file: String = __FILE__, line: Int = __LINE__) -> AsyncShellTask { +public func runAsync (executable: String, _ args: Any ..., file: String = #file, line: Int = #line) -> AsyncShellTask { return main.runAsync(executable, args, file: file, line: line) } diff --git a/Sources/SwiftShell/General/Lazy-split.swift b/Sources/SwiftShell/General/Lazy-split.swift index de05236..a0b5a74 100644 --- a/Sources/SwiftShell/General/Lazy-split.swift +++ b/Sources/SwiftShell/General/Lazy-split.swift @@ -66,7 +66,7 @@ public struct PartialSourceLazySplitSequence ? public init (bases: ()->Base?, separator: Base.Generator.Element) { - gs = anyGenerator(bases).lazy.map { + gs = AnyGenerator(body: bases).lazy.map { LazySplitSequence($0, separator: separator, allowEmptySlices: true).generate() }.generate() }