@@ -46,21 +46,27 @@ extension ProgressReporter {
46
46
self . rawOption = rawOption
47
47
}
48
48
}
49
- enum CodingKeys : String , CodingKey {
50
- case locale
51
- case option
49
+
50
+ struct CodableRepresentation : Codable {
51
+ let locale : Locale
52
+ let includeFileDescription : Bool
53
+ }
54
+
55
+ var codableRepresentation : CodableRepresentation {
56
+ . init( locale: self . locale, includeFileDescription: option. rawOption == . file)
52
57
}
53
58
54
59
public init ( from decoder: any Decoder ) throws {
55
- let container = try decoder. container ( keyedBy: CodingKeys . self)
56
- locale = try container. decode ( Locale . self, forKey: . locale)
57
- option = try container. decode ( Option . self, forKey: . option)
60
+ //TODO: Fix this later, codableRepresentation is not settable
61
+ let container = try decoder. singleValueContainer ( )
62
+ let rep = try container. decode ( CodableRepresentation . self)
63
+ locale = rep. locale
64
+ option = . file
58
65
}
59
-
66
+
60
67
public func encode( to encoder: any Encoder ) throws {
61
- var container = encoder. container ( keyedBy: CodingKeys . self)
62
- try container. encode ( locale, forKey: . locale)
63
- try container. encode ( option, forKey: . option)
68
+ var container = encoder. singleValueContainer ( )
69
+ try container. encode ( codableRepresentation)
64
70
}
65
71
66
72
public var locale : Locale
0 commit comments