Skip to content

Commit 1d78e62

Browse files
committed
Move ShellOutCommand to own file
1 parent d40e0bf commit 1d78e62

File tree

2 files changed

+35
-35
lines changed

2 files changed

+35
-35
lines changed

Sources/ShellOut.swift

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -91,41 +91,6 @@ import Algorithms
9191
)
9292
}
9393

94-
/// Structure used to pre-define commands for use with ShellOut
95-
public struct ShellOutCommand {
96-
/// The string that makes up the command that should be run on the command line
97-
public var command: String
98-
99-
public var arguments: [String]
100-
101-
/// Initialize a value using a string that makes up the underlying command
102-
public init(command: String, arguments: [String] = []) {
103-
self.command = command
104-
self.arguments = arguments
105-
}
106-
107-
public func appending(arguments newArguments: [String]) -> Self {
108-
.init(command: command, arguments: arguments + newArguments)
109-
}
110-
111-
public func appending(argument: String) -> Self {
112-
appending(arguments: [argument])
113-
}
114-
115-
public mutating func append(arguments newArguments: [String]) {
116-
self.arguments = self.arguments + newArguments
117-
}
118-
119-
public mutating func append(argument: String) {
120-
append(arguments: [argument])
121-
}
122-
}
123-
124-
extension ShellOutCommand: CustomStringConvertible {
125-
public var description: String {
126-
([command] + arguments).joined(separator: " ")
127-
}
128-
}
12994

13095
public extension ShellOutCommand {
13196
static func bash(arguments: [Argument]) -> Self {

Sources/ShellOutCommand.swift

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/// Structure used to pre-define commands for use with ShellOut
2+
public struct ShellOutCommand {
3+
/// The string that makes up the command that should be run on the command line
4+
public var command: String
5+
6+
public var arguments: [String]
7+
8+
/// Initialize a value using a string that makes up the underlying command
9+
public init(command: String, arguments: [String] = []) {
10+
self.command = command
11+
self.arguments = arguments
12+
}
13+
14+
public func appending(arguments newArguments: [String]) -> Self {
15+
.init(command: command, arguments: arguments + newArguments)
16+
}
17+
18+
public func appending(argument: String) -> Self {
19+
appending(arguments: [argument])
20+
}
21+
22+
public mutating func append(arguments newArguments: [String]) {
23+
self.arguments = self.arguments + newArguments
24+
}
25+
26+
public mutating func append(argument: String) {
27+
append(arguments: [argument])
28+
}
29+
}
30+
31+
extension ShellOutCommand: CustomStringConvertible {
32+
public var description: String {
33+
([command] + arguments).joined(separator: " ")
34+
}
35+
}

0 commit comments

Comments
 (0)