@@ -227,6 +227,28 @@ addHookFilesToConfig config = do
227
227
(config, [] )
228
228
229
229
230
+ data Column = IdCol | PrioCol | OpenedUTCCol | AgeCol | BodyCol | EmptyCol
231
+ deriving (Eq , Show , Generic )
232
+
233
+
234
+ instance ToJSON Column where
235
+ toJSON IdCol = String " id"
236
+ toJSON PrioCol = String " prio"
237
+ toJSON OpenedUTCCol = String " openedUtc"
238
+ toJSON AgeCol = String " age"
239
+ toJSON BodyCol = String " body"
240
+ toJSON EmptyCol = String " "
241
+ instance FromJSON Column where
242
+ parseJSON = withText " Column" $ \ value -> do
243
+ case value of
244
+ " id" -> pure IdCol
245
+ " prio" -> pure PrioCol
246
+ " openedUtc" -> pure OpenedUTCCol
247
+ " age" -> pure AgeCol
248
+ " body" -> pure BodyCol
249
+ _ -> pure EmptyCol
250
+
251
+
230
252
data Config = Config
231
253
{ tableName :: Text
232
254
, idStyle :: AnsiStyle
@@ -240,6 +262,7 @@ data Config = Config
240
262
, tagStyle :: AnsiStyle
241
263
, utcFormat :: TimeFormatString
242
264
, utcFormatShort :: TimeFormatString
265
+ , columns :: [Column ]
243
266
, dataDir :: FilePath
244
267
, dbName :: FilePath
245
268
, dateWidth :: Int
@@ -271,6 +294,7 @@ instance FromJSON Config where
271
294
utcFormat <- o .:? " utcFormat" .!= defaultConfig. utcFormat
272
295
utcFormatShort <- o .:? " utcFormatShort" .!= defaultConfig. utcFormatShort
273
296
dataDir <- o .:? " dataDir" .!= defaultConfig. dataDir
297
+ columns <- o .:? " columns" .!= defaultConfig. columns
274
298
dbName <- o .:? " dbName" .!= defaultConfig. dbName
275
299
dateWidth <- o .:? " dateWidth" .!= defaultConfig. dateWidth
276
300
bodyWidth <- o .:? " bodyWidth" .!= defaultConfig. bodyWidth
@@ -367,6 +391,7 @@ defaultConfig =
367
391
, tagStyle = color Blue
368
392
, utcFormat = toFormat (" YYYY-MM-DD H:MI:S" :: [Char ])
369
393
, utcFormatShort = toFormat (" YYYY-MM-DD H:MI" :: [Char ])
394
+ , columns = [IdCol , PrioCol , OpenedUTCCol , BodyCol ]
370
395
, dataDir = " "
371
396
, dbName = " main.db"
372
397
, dateWidth = 10
0 commit comments