Skip to content

Commit e2d108a

Browse files
committed
Simplify the configuration property's implementation across all commands
1 parent 7c1c56c commit e2d108a

File tree

6 files changed

+22
-32
lines changed

6 files changed

+22
-32
lines changed

SwiftSyntaxDevUtils/Sources/swift-syntax-dev-utils/SwiftSyntaxDevUtils.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import ArgumentParser
1515
@main
1616
struct SwiftSyntaxDevUtils: ParsableCommand {
1717

18-
static var configuration: CommandConfiguration = CommandConfiguration(
18+
static let configuration = CommandConfiguration(
1919
abstract: """
2020
Build and test script for SwiftSyntax.
2121

SwiftSyntaxDevUtils/Sources/swift-syntax-dev-utils/commands/Build.swift

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,9 @@ import ArgumentParser
1414
import Foundation
1515

1616
struct Build: ParsableCommand, BuildCommand {
17-
static var configuration: CommandConfiguration {
18-
return CommandConfiguration(
19-
abstract: "Build swift-syntax."
20-
)
21-
}
17+
static let configuration = CommandConfiguration(
18+
abstract: "Build swift-syntax."
19+
)
2220

2321
@OptionGroup
2422
var arguments: BuildArguments

SwiftSyntaxDevUtils/Sources/swift-syntax-dev-utils/commands/Format.swift

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,15 @@ fileprivate let directoriesToExclude = [
2424
]
2525

2626
struct Format: ParsableCommand {
27-
static var configuration: CommandConfiguration {
28-
return CommandConfiguration(
29-
abstract: "Format files in SwiftSyntax using swift-format.",
30-
discussion: """
31-
This command automatically builds the '\(Self.swiftFormatBranch)' branch \
32-
of swift-format in the '\(Paths.swiftFormatBuildDir.lastPathComponent)' \
33-
directory of this repository and uses the build to format the swift-syntax \
34-
sources.
35-
"""
36-
)
37-
}
27+
static let configuration = CommandConfiguration(
28+
abstract: "Format files in SwiftSyntax using swift-format.",
29+
discussion: """
30+
This command automatically builds the '\(Self.swiftFormatBranch)' branch \
31+
of swift-format in the '\(Paths.swiftFormatBuildDir.lastPathComponent)' \
32+
directory of this repository and uses the build to format the swift-syntax \
33+
sources.
34+
"""
35+
)
3836

3937
@Flag(help: "Update the sources of swift-format and rebuild swift-format")
4038
var update: Bool = false

SwiftSyntaxDevUtils/Sources/swift-syntax-dev-utils/commands/GenerateSourceCode.swift

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,9 @@ import ArgumentParser
1414
import Foundation
1515

1616
struct GenerateSourceCode: ParsableCommand, SourceCodeGeneratorCommand {
17-
static var configuration: CommandConfiguration {
18-
return CommandConfiguration(
19-
abstract: "Generate swift-syntax sources."
20-
)
21-
}
17+
static let configuration = CommandConfiguration(
18+
abstract: "Generate swift-syntax sources."
19+
)
2220

2321
@OptionGroup
2422
var arguments: SourceCodeGeneratorArguments

SwiftSyntaxDevUtils/Sources/swift-syntax-dev-utils/commands/Test.swift

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,9 @@ import ArgumentParser
1414
import Foundation
1515

1616
struct Test: ParsableCommand, BuildCommand {
17-
static var configuration: CommandConfiguration {
18-
return CommandConfiguration(
19-
abstract: "Run swift-syntax tests."
20-
)
21-
}
17+
static let configuration = CommandConfiguration(
18+
abstract: "Run swift-syntax tests."
19+
)
2220

2321
@OptionGroup
2422
var arguments: BuildArguments

SwiftSyntaxDevUtils/Sources/swift-syntax-dev-utils/commands/VerifySourceCode.swift

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,9 @@ fileprivate var modules: [String] {
1818
}
1919

2020
struct VerifySourceCode: ParsableCommand, SourceCodeGeneratorCommand {
21-
static var configuration: CommandConfiguration {
22-
return CommandConfiguration(
23-
abstract: "Verify that the generated sources match the ones checked into the repository."
24-
)
25-
}
21+
static let configuration = CommandConfiguration(
22+
abstract: "Verify that the generated sources match the ones checked into the repository."
23+
)
2624

2725
@OptionGroup
2826
var arguments: SourceCodeGeneratorArguments

0 commit comments

Comments
 (0)