Skip to content

Commit e4d06e8

Browse files
committed
Format
1 parent fd6976a commit e4d06e8

File tree

6 files changed

+29
-10
lines changed

6 files changed

+29
-10
lines changed

Examples/echo-metadata/Package.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ let package = Package(
2121
name: "echo-metadata",
2222
platforms: [.macOS("15.0")],
2323
dependencies: [
24-
// .package(url: "https://github.com/grpc/grpc-swift.git", exact: "2.0.0-rc.1"),
24+
// .package(url: "https://github.com/grpc/grpc-swift.git", exact: "2.0.0-rc.1"),
2525
.package(name: "grpc-swift", path: "../../"),
2626
.package(url: "https://github.com/grpc/grpc-swift-protobuf.git", exact: "1.0.0-rc.1"),
2727
.package(url: "https://github.com/grpc/grpc-swift-nio-transport.git", exact: "1.0.0-rc.1"),

Examples/echo-metadata/Sources/ClientArguments.swift

+4-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ struct ClientArguments: ParsableArguments {
2121
@Option(help: "The server's listening port")
2222
var port: Int = 1234
2323

24-
@Option(help: "Message to send to the server. It will also be sent in the request's metadata as the value for `echo-message`.")
24+
@Option(
25+
help:
26+
"Message to send to the server. It will also be sent in the request's metadata as the value for `echo-message`."
27+
)
2528
var message: String
2629
}
2730

Examples/echo-metadata/Sources/Subcommands/Collect.swift

+3-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ struct Collect: AsyncParsableCommand {
4343
try await writer.write(.with { $0.text = String(part) })
4444
}
4545
} onResponse: { response in
46-
print("collect ← initial metadata: \(response.metadata.filter({ $0.key.starts(with: "echo-") }))")
46+
print(
47+
"collect ← initial metadata: \(response.metadata.filter({ $0.key.starts(with: "echo-") }))"
48+
)
4749
print("collect ← message: \(try response.message.text)")
4850
print("collect ← trailing metadata: \(response.trailingMetadata)")
4951
}

Examples/echo-metadata/Sources/Subcommands/Expand.swift

+6-2
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,18 @@ struct Expand: AsyncParsableCommand {
4343
try await echo.expand(message, metadata: requestMetadata) { response in
4444
let responseContents = try response.accepted.get()
4545

46-
print("expand ← initial metadata: \(Metadata(responseContents.metadata.filter({ $0.key.starts(with: "echo-") })))")
46+
print(
47+
"expand ← initial metadata: \(Metadata(responseContents.metadata.filter({ $0.key.starts(with: "echo-") })))"
48+
)
4749
for try await part in responseContents.bodyParts {
4850
switch part {
4951
case .message(let message):
5052
print("expand ← message: \(message.text)")
5153

5254
case .trailingMetadata(let trailingMetadata):
53-
print("expand ← trailing metadata: \(Metadata(trailingMetadata.filter({ $0.key.starts(with: "echo-") })))")
55+
print(
56+
"expand ← trailing metadata: \(Metadata(trailingMetadata.filter({ $0.key.starts(with: "echo-") })))"
57+
)
5458
}
5559
}
5660
}

Examples/echo-metadata/Sources/Subcommands/Get.swift

+9-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ import GRPCCore
1919
import GRPCNIOTransportHTTP2
2020

2121
struct Get: AsyncParsableCommand {
22-
static let configuration = CommandConfiguration(abstract: "Makes a unary RPC to the echo-metadata server.")
22+
static let configuration = CommandConfiguration(
23+
abstract: "Makes a unary RPC to the echo-metadata server."
24+
)
2325

2426
@OptionGroup
2527
var arguments: ClientArguments
@@ -38,9 +40,13 @@ struct Get: AsyncParsableCommand {
3840
print("get → metadata: \(requestMetadata)")
3941
print("get → message: \(message.text)")
4042
try await echo.get(message, metadata: requestMetadata) { response in
41-
print("get ← initial metadata: \(Metadata(response.metadata.filter({ $0.key.starts(with: "echo-") })))")
43+
print(
44+
"get ← initial metadata: \(Metadata(response.metadata.filter({ $0.key.starts(with: "echo-") })))"
45+
)
4246
print("get ← message: \(try response.message.text)")
43-
print("get ← trailing metadata: \(Metadata(response.trailingMetadata.filter({ $0.key.starts(with: "echo-") })))")
47+
print(
48+
"get ← trailing metadata: \(Metadata(response.trailingMetadata.filter({ $0.key.starts(with: "echo-") })))"
49+
)
4450
}
4551
}
4652
}

Examples/echo-metadata/Sources/Subcommands/Update.swift

+6-2
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,18 @@ struct Update: AsyncParsableCommand {
4545
} onResponse: { response in
4646
let responseContents = try response.accepted.get()
4747

48-
print("update ← initial metadata: \(Metadata(responseContents.metadata.filter({ $0.key.starts(with: "echo-") })))")
48+
print(
49+
"update ← initial metadata: \(Metadata(responseContents.metadata.filter({ $0.key.starts(with: "echo-") })))"
50+
)
4951
for try await part in responseContents.bodyParts {
5052
switch part {
5153
case .message(let message):
5254
print("update ← message: \(message.text)")
5355

5456
case .trailingMetadata(let trailingMetadata):
55-
print("update ← trailing metadata: \(Metadata(trailingMetadata.filter({ $0.key.starts(with: "echo-") })))")
57+
print(
58+
"update ← trailing metadata: \(Metadata(trailingMetadata.filter({ $0.key.starts(with: "echo-") })))"
59+
)
5660
}
5761
}
5862
}

0 commit comments

Comments
 (0)