diff --git a/Sources/CUPSAdminApp/QuickActionSheet.swift b/Sources/CUPSAdminApp/QuickActionSheet.swift index 290f426..3ba4530 100644 --- a/Sources/CUPSAdminApp/QuickActionSheet.swift +++ b/Sources/CUPSAdminApp/QuickActionSheet.swift @@ -180,7 +180,7 @@ struct QuickActionSheet: View { @ViewBuilder private var content: some View { if model.action.input == .userCode { Form { - LabeledContent("Current \(model.inputLabel.lowercased())") { + LabeledContent("Current \(model.inputLabel)") { HStack(spacing: 8) { if let current = model.currentCode { Text(model.showCurrentCode ? current : String(repeating: "•", count: current.count)) @@ -202,7 +202,7 @@ struct QuickActionSheet: View { .frame(width: 160) .disabled(model.phase != .ready) } label: { - Text("New \(model.inputLabel.lowercased())") + Text("New \(model.inputLabel)") if let error = model.validationError { Text(error).foregroundStyle(.red) } diff --git a/Sources/CupsKit/QuickActions.swift b/Sources/CupsKit/QuickActions.swift index dfac9e8..81ed9bc 100644 --- a/Sources/CupsKit/QuickActions.swift +++ b/Sources/CupsKit/QuickActions.swift @@ -104,8 +104,8 @@ public struct QuickAction: Identifiable, Hashable { return resolved.profile.inputs[id] } - /// "User code" (Ricoh) or the profile's label ("User ID" for Xerox). - public func inputLabel(_ context: DriverContext) -> String { inputSpec(context)?.label ?? "User code" } + /// "User Code" (Ricoh) or the profile's label ("User ID" for Xerox). Shown as written, never re-cased. + public func inputLabel(_ context: DriverContext) -> String { inputSpec(context)?.label ?? "User Code" } /// The optional second value's label ("Account ID (optional)"), or nil when the profile has none. public func secondInputLabel(_ context: DriverContext) -> String? { inputSpec(context)?.second?.label } diff --git a/Sources/cupsadmin/Commands/QuickCommand.swift b/Sources/cupsadmin/Commands/QuickCommand.swift index ac7b2b5..ffe53e8 100644 --- a/Sources/cupsadmin/Commands/QuickCommand.swift +++ b/Sources/cupsadmin/Commands/QuickCommand.swift @@ -52,7 +52,7 @@ enum QuickCommand { let before = try await OptionState.load(client: client, queue: queue) let context = DriverContext(ppd: before.ppd, attributes: before.snapshot.attributes) if let value, let error = action.validationError(value, context: context) { - throw CupsAdminError.usage("\(action.inputLabel(context).lowercased()) \(value): \(error)") + throw CupsAdminError.usage("\(action.inputLabel(context)) \(value): \(error)") } if let secondValue, let error = action.secondValidationError(secondValue, context: context) { throw CupsAdminError.usage("second value \(secondValue): \(error)") diff --git a/Tests/CupsKitTests/QuickActionTests.swift b/Tests/CupsKitTests/QuickActionTests.swift index 79a389b..005118e 100644 --- a/Tests/CupsKitTests/QuickActionTests.swift +++ b/Tests/CupsKitTests/QuickActionTests.swift @@ -56,7 +56,7 @@ private func profileID(_ id: String, _ context: DriverContext) -> String? { let clear = try QuickAction.named("usercode")!.resolve(c, clearing: true).get().changes #expect(clear.map(\.value) == ["False", "None"]) // Ricoh takes one value: digits, no second input. - #expect(QuickAction.named("usercode")!.inputLabel(c) == "User code") + #expect(QuickAction.named("usercode")!.inputLabel(c) == "User Code") #expect(QuickAction.named("usercode")!.secondInputLabel(c) == nil) #expect(throws: QuickActionUnavailable.self) { try QuickAction.named("usercode")!.resolve(c, value: "4321", secondValue: "9").get() } }