Skip to content

Commit 4933fb8

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 4933fb8

File tree

2 files changed

+32
-19
lines changed

2 files changed

+32
-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: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,36 +28,45 @@ 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 =
33+
ProcessInfo.processInfo.environment["CONTAINERTOOL_DEFAULT_REGISTRY"] ?? "docker.io"
3334

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

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

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

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

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

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

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

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

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

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

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

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

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

0 commit comments

Comments
 (0)