Skip to content

Commit a3c79b4

Browse files
committed
Simplify prettyArguments
1 parent f56c92d commit a3c79b4

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

Sources/POSIX/misc.swift

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,8 @@
1111
/**
1212
For an array of String arguments that would be passed to system() or
1313
popen(), returns a pretty-printed string that is user-readable and
14-
could be typed into a Terminal to reattempt execution.
14+
could be typed into a Terminal to re-attempt execution.
1515
*/
1616
public func prettyArguments(args: [String]) -> String {
17-
return args.map { arg in
18-
let chars = arg.characters
19-
if chars.contains(" ") {
20-
return chars.split(" ").map(String.init).joinWithSeparator("\\ ")
21-
} else {
22-
return arg
23-
}
24-
}.joinWithSeparator(" ")
17+
return args.map { $0.characters.split(" ").map(String.init).joinWithSeparator("\\ ") }.joinWithSeparator(" ")
2518
}

0 commit comments

Comments
 (0)