Skip to content

Commit bba372f

Browse files
committed
Package.swift, containertool: Make multi-line definitions clearer
Commit 9a3e7af configured Swift Format to retain existing line breaks to make complex test case definitions easier to read. This commit reformats complex definitions in Package.swift and containertool to make more readable.
1 parent 7f92276 commit bba372f

File tree

2 files changed

+31
-19
lines changed

2 files changed

+31
-19
lines changed

Package.swift

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ let package = Package(
4040
.executableTarget(
4141
name: "containertool",
4242
dependencies: [
43-
.target(name: "ContainerRegistry"), .target(name: "VendorCNIOExtrasZlib"), .target(name: "Tar"),
43+
.target(name: "ContainerRegistry"),
44+
.target(name: "VendorCNIOExtrasZlib"),
45+
.target(name: "Tar"),
4446
.product(name: "ArgumentParser", package: "swift-argument-parser"),
4547
],
4648
swiftSettings: [.swiftLanguageMode(.v5)]
@@ -51,7 +53,8 @@ let package = Package(
5153
dependencies: [],
5254
path: "Vendor/github.com/apple/swift-nio-extras/Sources/CNIOExtrasZlib",
5355
linkerSettings: [.linkedLibrary("z")]
54-
), .target(name: "Tar"),
56+
),
57+
.target(name: "Tar"),
5558
.target(
5659
// Vendored from https://github.com/apple/swift-package-manager with modifications
5760
name: "Basics",
@@ -86,7 +89,8 @@ let package = Package(
8689
name: "ContainerRegistryTests",
8790
dependencies: [.target(name: "ContainerRegistry")],
8891
resources: [.process("Resources")]
89-
), .testTarget(name: "containertoolTests", dependencies: [.target(name: "containertool")]),
92+
),
93+
.testTarget(name: "containertoolTests", dependencies: [.target(name: "containertool")]),
9094
.testTarget(name: "TarTests", dependencies: [.target(name: "Tar")]),
9195
],
9296
swiftLanguageModes: [.v6]

Sources/containertool/containertool.swift

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,36 +28,44 @@ enum AllowHTTP: String, ExpressibleByArgument, CaseIterable { case source, desti
2828
abstract: "Build and upload a container image"
2929
)
3030

31-
@Option(help: "Default registry for references which do not specify a registry") private var defaultRegistry:
32-
String = ProcessInfo.processInfo.environment["CONTAINERTOOL_DEFAULT_REGISTRY"] ?? "docker.io"
31+
@Option(help: "Default registry for references which do not specify a registry")
32+
private var defaultRegistry: String = ProcessInfo.processInfo.environment["CONTAINERTOOL_DEFAULT_REGISTRY"] ?? "docker.io"
3333

34-
@Option(help: "Repository path") private var repository: String
34+
@Option(help: "Repository path")
35+
private var repository: String
3536

36-
@Argument(help: "Executable to package") private var executable: String
37+
@Argument(help: "Executable to package")
38+
private var executable: String
3739

38-
@Option(help: "Username") private var username: String?
40+
@Option(help: "Username")
41+
private var username: String?
3942

40-
@Option(help: "Password") private var password: String?
43+
@Option(help: "Password")
44+
private var password: String?
4145

42-
@Flag(name: .shortAndLong, help: "Verbose output") private var verbose: Bool = false
46+
@Flag(name: .shortAndLong, help: "Verbose output")
47+
private var verbose: Bool = false
4348

44-
@Option(help: "Connect to the container registry using plaintext HTTP") var allowInsecureHttp: AllowHTTP?
49+
@Option(help: "Connect to the container registry using plaintext HTTP")
50+
var allowInsecureHttp: AllowHTTP?
4551

46-
@Option(help: "CPU architecture") private var architecture: String =
47-
ProcessInfo.processInfo.environment["CONTAINERTOOL_ARCHITECTURE"] ?? "amd64"
52+
@Option(help: "CPU architecture")
53+
private var architecture: String = ProcessInfo.processInfo.environment["CONTAINERTOOL_ARCHITECTURE"] ?? "amd64"
4854

49-
@Option(help: "Base image reference") private var from: String =
50-
ProcessInfo.processInfo.environment["CONTAINERTOOL_BASE_IMAGE"] ?? "swift:slim"
55+
@Option(help: "Base image reference")
56+
private var from: String = ProcessInfo.processInfo.environment["CONTAINERTOOL_BASE_IMAGE"] ?? "swift:slim"
5157

52-
@Option(help: "Operating system") private var os: String =
53-
ProcessInfo.processInfo.environment["CONTAINERTOOL_OS"] ?? "linux"
58+
@Option(help: "Operating system")
59+
private var os: String = ProcessInfo.processInfo.environment["CONTAINERTOOL_OS"] ?? "linux"
5460

55-
@Option(help: "Tag for this manifest") private var tag: String?
61+
@Option(help: "Tag for this manifest")
62+
private var tag: String?
5663

5764
@Flag(inversion: .prefixedEnableDisable, exclusivity: .exclusive, help: "Load credentials from a netrc file")
5865
private var netrc: Bool = true
5966

60-
@Option(help: "Specify the netrc file path") private var netrcFile: String?
67+
@Option(help: "Specify the netrc file path")
68+
private var netrcFile: String?
6169

6270
func run() async throws {
6371
let baseimage = try ImageReference(fromString: from, defaultRegistry: defaultRegistry)

0 commit comments

Comments
 (0)