@@ -96,11 +96,7 @@ public struct ShellOutCommand {
96
96
self . init ( command: try SafeString ( command) , arguments: arguments)
97
97
}
98
98
99
- public init ( safeCommand: String , arguments: [ Argument ] = [ ] ) {
100
- self . init ( command: SafeString ( unchecked: safeCommand) , arguments: arguments)
101
- }
102
-
103
- public init ( command: SafeString , arguments: [ Argument ] ) {
99
+ public init ( command: SafeString , arguments: [ Argument ] = [ ] ) {
104
100
self . command = command
105
101
self . arguments = arguments
106
102
}
@@ -131,7 +127,7 @@ public struct ShellOutCommand {
131
127
public extension ShellOutCommand {
132
128
/// Initialize a git repository
133
129
static func gitInit( ) -> ShellOutCommand {
134
- . init( safeCommand : " git " , arguments: [ " init " . verbatim] )
130
+ . init( command : " git " . unchecked , arguments: [ " init " . verbatim] )
135
131
}
136
132
137
133
/// Clone a git repository at a given URL
@@ -211,7 +207,7 @@ public extension ShellOutCommand {
211
207
212
208
/// Checkout a given git branch
213
209
static func gitCheckout( branch: String , quiet: Bool = true ) -> ShellOutCommand {
214
- var command = ShellOutCommand ( safeCommand : " git " ,
210
+ var command = ShellOutCommand ( command : " git " . unchecked ,
215
211
arguments: [ " checkout " . verbatim, branch. quoted] )
216
212
217
213
if quiet {
@@ -223,8 +219,9 @@ public extension ShellOutCommand {
223
219
224
220
private static func git( allowingPrompt: Bool ) -> Self {
225
221
allowingPrompt
226
- ? . init( safeCommand: " git " )
227
- : . init( safeCommand: " env " , arguments: [ " GIT_TERMINAL_PROMPT=0 " , " git " ] . verbatim)
222
+ ? . init( command: " git " . unchecked)
223
+ : . init( command: " env " . unchecked,
224
+ arguments: [ " GIT_TERMINAL_PROMPT=0 " , " git " ] . verbatim)
228
225
229
226
}
230
227
}
@@ -233,62 +230,64 @@ public extension ShellOutCommand {
233
230
public extension ShellOutCommand {
234
231
/// Create a folder with a given name
235
232
static func createFolder( named name: String ) -> ShellOutCommand {
236
- . init( safeCommand : " mkdir " , arguments: [ name. quoted] )
233
+ . init( command : " mkdir " . unchecked , arguments: [ name. quoted] )
237
234
}
238
235
239
236
/// Create a file with a given name and contents (will overwrite any existing file with the same name)
240
237
static func createFile( named name: String , contents: String ) -> ShellOutCommand {
241
- . init( safeCommand : " echo " , arguments: [ contents. quoted] )
238
+ . init( command : " echo " . unchecked , arguments: [ contents. quoted] )
242
239
. appending ( argument: " > " . verbatim)
243
240
. appending ( argument: name. quoted)
244
241
}
245
242
246
243
/// Move a file from one path to another
247
244
static func moveFile( from originPath: String , to targetPath: String ) -> ShellOutCommand {
248
- . init( safeCommand : " mv " , arguments: [ originPath, targetPath] . quoted)
245
+ . init( command : " mv " . unchecked , arguments: [ originPath, targetPath] . quoted)
249
246
}
250
247
251
248
/// Copy a file from one path to another
252
249
static func copyFile( from originPath: String , to targetPath: String ) -> ShellOutCommand {
253
- . init( safeCommand : " cp " , arguments: [ originPath, targetPath] . quoted)
250
+ . init( command : " cp " . unchecked , arguments: [ originPath, targetPath] . quoted)
254
251
}
255
252
256
253
/// Remove a file
257
254
static func removeFile( from path: String , arguments: [ String ] = [ " -f " ] ) -> ShellOutCommand {
258
- . init( safeCommand : " rm " , arguments: arguments. quoted + [ path. quoted] )
255
+ . init( command : " rm " . unchecked , arguments: arguments. quoted + [ path. quoted] )
259
256
}
260
257
261
258
/// Open a file using its designated application
262
259
static func openFile( at path: String ) -> ShellOutCommand {
263
- . init( safeCommand : " open " , arguments: [ path. quoted] )
260
+ . init( command : " open " . unchecked , arguments: [ path. quoted] )
264
261
}
265
262
266
263
/// Read a file as a string
267
264
static func readFile( at path: String ) -> ShellOutCommand {
268
- . init( safeCommand : " cat " , arguments: [ path. quoted] )
265
+ . init( command : " cat " . unchecked , arguments: [ path. quoted] )
269
266
}
270
267
271
268
/// Create a symlink at a given path, to a given target
272
269
static func createSymlink( to targetPath: String , at linkPath: String ) -> ShellOutCommand {
273
- . init( safeCommand : " ln " , arguments: [ " -s " , targetPath, linkPath] . quoted)
270
+ . init( command : " ln " . unchecked , arguments: [ " -s " , targetPath, linkPath] . quoted)
274
271
}
275
272
276
273
/// Expand a symlink at a given path, returning its target path
277
274
static func expandSymlink( at path: String ) -> ShellOutCommand {
278
- . init( safeCommand : " readlink " , arguments: [ path. quoted] )
275
+ . init( command : " readlink " . unchecked , arguments: [ path. quoted] )
279
276
}
280
277
}
281
278
282
279
/// Marathon commands
283
280
public extension ShellOutCommand {
284
281
/// Run a Marathon Swift script
285
282
static func runMarathonScript( at path: String , arguments: [ String ] = [ ] ) -> ShellOutCommand {
286
- . init( safeCommand: " marathon " , arguments: [ " run " , path] . quoted + arguments. quoted)
283
+ . init( command: " marathon " . unchecked,
284
+ arguments: [ " run " , path] . quoted + arguments. quoted)
287
285
}
288
286
289
287
/// Update all Swift packages managed by Marathon
290
288
static func updateMarathonPackages( ) -> ShellOutCommand {
291
- . init( safeCommand: " marathon " , arguments: [ " update " . verbatim] )
289
+ . init( command: " marathon " . unchecked,
290
+ arguments: [ " update " . verbatim] )
292
291
}
293
292
}
294
293
@@ -308,29 +307,30 @@ public extension ShellOutCommand {
308
307
309
308
/// Create a Swift package with a given type (see SwiftPackageType for options)
310
309
static func createSwiftPackage( withType type: SwiftPackageType = . library) -> ShellOutCommand {
311
- . init( safeCommand : " swift " ,
310
+ . init( command : " swift " . unchecked ,
312
311
arguments: [ " package init --type \( type) " . verbatim] )
313
312
}
314
313
315
314
/// Update all Swift package dependencies
316
315
static func updateSwiftPackages( ) -> ShellOutCommand {
317
- . init( safeCommand : " swift " , arguments: [ " package " , " update " ] . verbatim)
316
+ . init( command : " swift " . unchecked , arguments: [ " package " , " update " ] . verbatim)
318
317
}
319
318
320
319
/// Generate an Xcode project for a Swift package
321
320
static func generateSwiftPackageXcodeProject( ) -> ShellOutCommand {
322
- . init( safeCommand: " swift " , arguments: [ " package " , " generate-xcodeproj " ] . verbatim)
321
+ . init( command: " swift " . unchecked,
322
+ arguments: [ " package " , " generate-xcodeproj " ] . verbatim)
323
323
}
324
324
325
325
/// Build a Swift package using a given configuration (see SwiftBuildConfiguration for options)
326
326
static func buildSwiftPackage( withConfiguration configuration: SwiftBuildConfiguration = . debug) -> ShellOutCommand {
327
- . init( safeCommand : " swift " ,
327
+ . init( command : " swift " . unchecked ,
328
328
arguments: [ " build -c \( configuration) " . verbatim] )
329
329
}
330
330
331
331
/// Test a Swift package using a given configuration (see SwiftBuildConfiguration for options)
332
332
static func testSwiftPackage( withConfiguration configuration: SwiftBuildConfiguration = . debug) -> ShellOutCommand {
333
- . init( safeCommand : " swift " ,
333
+ . init( command : " swift " . unchecked ,
334
334
arguments: [ " test -c \( configuration) " . verbatim] )
335
335
}
336
336
}
@@ -339,20 +339,20 @@ public extension ShellOutCommand {
339
339
public extension ShellOutCommand {
340
340
/// Run Fastlane using a given lane
341
341
static func runFastlane( usingLane lane: String ) -> ShellOutCommand {
342
- . init( safeCommand : " fastlane " , arguments: [ lane. quoted] )
342
+ . init( command : " fastlane " . unchecked , arguments: [ lane. quoted] )
343
343
}
344
344
}
345
345
346
346
/// CocoaPods commands
347
347
public extension ShellOutCommand {
348
348
/// Update all CocoaPods dependencies
349
349
static func updateCocoaPods( ) -> ShellOutCommand {
350
- . init( safeCommand : " pod " , arguments: [ " update " . verbatim] )
350
+ . init( command : " pod " . unchecked , arguments: [ " update " . verbatim] )
351
351
}
352
352
353
353
/// Install all CocoaPods dependencies
354
354
static func installCocoaPods( ) -> ShellOutCommand {
355
- . init( safeCommand : " pod " , arguments: [ " install " . verbatim] )
355
+ . init( command : " pod " . unchecked , arguments: [ " install " . verbatim] )
356
356
}
357
357
}
358
358
0 commit comments