File tree Expand file tree Collapse file tree 2 files changed +23
-16
lines changed Expand file tree Collapse file tree 2 files changed +23
-16
lines changed Original file line number Diff line number Diff line change @@ -284,17 +284,20 @@ public final class InitPackage {
284
284
} else if packageType == . buildToolPlugin {
285
285
param += """
286
286
.plugin(
287
- name: " \( typeName) " ,
288
- capability: .buildTool()
289
- ),
287
+ name: " \( typeName) " ,
288
+ capability: .buildTool()
289
+ ),
290
290
]
291
291
"""
292
292
} else if packageType == . commandPlugin {
293
293
param += """
294
294
.plugin(
295
- name: " \( typeName) " ,
296
- capability: .command(intent: .custom(verb: " \( typeName) " , description: " prints hello world " ))
297
- ),
295
+ name: " \( typeName) " ,
296
+ capability: .command(intent: .custom(
297
+ verb: " \( typeName) " ,
298
+ description: " prints hello world "
299
+ ))
300
+ ),
298
301
]
299
302
"""
300
303
} else if packageType == . macro {
@@ -398,24 +401,27 @@ public final class InitPackage {
398
401
import PackagePlugin
399
402
400
403
@main
404
+
401
405
"""
402
406
if packageType == . buildToolPlugin {
403
407
content += """
404
- struct \( typeName) : BuildToolPlugin {
405
- func createBuildCommands(context: PluginContext, target: Target) async throws -> [Command] {
406
- print( " Hello, World! " )
407
- return []
408
- }
408
+ struct \( typeName) : BuildToolPlugin {
409
+ func createBuildCommands(context: PluginContext, target: Target) async throws -> [Command] {
410
+ print( " Hello, World! " )
411
+ return []
409
412
}
413
+ }
414
+
410
415
"""
411
416
}
412
417
else {
413
418
content += """
414
- struct \( typeName) : CommandPlugin {
415
- func performCommand(context: PluginContext, arguments: [String]) async throws {
416
- print( " Hello, World! " )
417
- }
419
+ struct \( typeName) : CommandPlugin {
420
+ func performCommand(context: PluginContext, arguments: [String]) async throws {
421
+ print( " Hello, World! " )
418
422
}
423
+ }
424
+
419
425
"""
420
426
}
421
427
Original file line number Diff line number Diff line change @@ -169,7 +169,8 @@ class InitTests: XCTestCase {
169
169
XCTAssertFileExists ( manifest)
170
170
let manifestContents : String = try localFileSystem. readFileContents ( manifest)
171
171
XCTAssertMatch ( manifestContents, . and( . contains( " .plugin( " ) , . contains( " targets: [ \" MyCommandPlugin \" ] " ) ) )
172
- XCTAssertMatch ( manifestContents, . and( . contains( " .plugin( " ) , . contains( " capability: .command(intent: .custom(verb " ) ) )
172
+ XCTAssertMatch ( manifestContents, . and( . contains( " .plugin( " ) ,
173
+ . and( . contains( " capability: .command(intent: .custom( " ) , . contains( " verb: \" MyCommandPlugin \" " ) ) ) )
173
174
174
175
let source = path. appending ( " Plugins " , " MyCommandPlugin.swift " )
175
176
XCTAssertFileExists ( source)
You can’t perform that action at this time.
0 commit comments