@@ -131,45 +131,57 @@ public extension ShellOutCommand {
131
131
}
132
132
133
133
/// Clone a git repository at a given URL
134
- static func gitClone( url: URL , to path: String ? = nil , allowingPrompt: Bool = true ) -> ShellOutCommand {
134
+ static func gitClone( url: URL , to path: String ? = nil , allowingPrompt: Bool = true , quiet : Bool = true ) -> ShellOutCommand {
135
135
var command = " \( git ( allowingPrompt: allowingPrompt) ) clone \( url. absoluteString) "
136
136
path. map { command. append ( argument: $0) }
137
- command. append ( " --quiet " )
137
+
138
+ if quiet {
139
+ command. append ( " --quiet " )
140
+ }
138
141
139
142
return ShellOutCommand ( string: command)
140
143
}
141
144
142
145
/// Create a git commit with a given message (also adds all untracked file to the index)
143
- static func gitCommit( message: String , allowingPrompt: Bool = true ) -> ShellOutCommand {
146
+ static func gitCommit( message: String , allowingPrompt: Bool = true , quiet : Bool = true ) -> ShellOutCommand {
144
147
var command = " \( git ( allowingPrompt: allowingPrompt) ) add . && git commit -a -m "
145
148
command. append ( argument: message)
146
- command. append ( " --quiet " )
149
+
150
+ if quiet {
151
+ command. append ( " --quiet " )
152
+ }
147
153
148
154
return ShellOutCommand ( string: command)
149
155
}
150
156
151
157
/// Perform a git push
152
- static func gitPush( remote: String ? = nil , branch: String ? = nil , allowingPrompt: Bool = true ) -> ShellOutCommand {
158
+ static func gitPush( remote: String ? = nil , branch: String ? = nil , allowingPrompt: Bool = true , quiet : Bool = true ) -> ShellOutCommand {
153
159
var command = " \( git ( allowingPrompt: allowingPrompt) ) push "
154
160
remote. map { command. append ( argument: $0) }
155
161
branch. map { command. append ( argument: $0) }
156
- command. append ( " --quiet " )
162
+
163
+ if quiet {
164
+ command. append ( " --quiet " )
165
+ }
157
166
158
167
return ShellOutCommand ( string: command)
159
168
}
160
169
161
170
/// Perform a git pull
162
- static func gitPull( remote: String ? = nil , branch: String ? = nil , allowingPrompt: Bool = true ) -> ShellOutCommand {
171
+ static func gitPull( remote: String ? = nil , branch: String ? = nil , allowingPrompt: Bool = true , quiet : Bool = true ) -> ShellOutCommand {
163
172
var command = " \( git ( allowingPrompt: allowingPrompt) ) pull "
164
173
remote. map { command. append ( argument: $0) }
165
174
branch. map { command. append ( argument: $0) }
166
- command. append ( " --quiet " )
175
+
176
+ if quiet {
177
+ command. append ( " --quiet " )
178
+ }
167
179
168
180
return ShellOutCommand ( string: command)
169
181
}
170
182
171
183
/// Run a git submodule update
172
- static func gitSubmoduleUpdate( initializeIfNeeded: Bool = true , recursive: Bool = true , allowingPrompt: Bool = true ) -> ShellOutCommand {
184
+ static func gitSubmoduleUpdate( initializeIfNeeded: Bool = true , recursive: Bool = true , allowingPrompt: Bool = true , quiet : Bool = true ) -> ShellOutCommand {
173
185
var command = " \( git ( allowingPrompt: allowingPrompt) ) submodule update "
174
186
175
187
if initializeIfNeeded {
@@ -180,14 +192,20 @@ public extension ShellOutCommand {
180
192
command. append ( " --recursive " )
181
193
}
182
194
183
- command. append ( " --quiet " )
195
+ if quiet {
196
+ command. append ( " --quiet " )
197
+ }
198
+
184
199
return ShellOutCommand ( string: command)
185
200
}
186
201
187
202
/// Checkout a given git branch
188
- static func gitCheckout( branch: String ) -> ShellOutCommand {
189
- let command = " git checkout " . appending ( argument: branch)
190
- . appending ( " --quiet " )
203
+ static func gitCheckout( branch: String , quiet: Bool = true ) -> ShellOutCommand {
204
+ var command = " git checkout " . appending ( argument: branch)
205
+
206
+ if quiet {
207
+ command. append ( " --quiet " )
208
+ }
191
209
192
210
return ShellOutCommand ( string: command)
193
211
}
0 commit comments