File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -108,6 +108,7 @@ data Command
108
108
| ImportEml
109
109
| IngestFile FilePath
110
110
| Csv
111
+ | Json
111
112
| Ndjson
112
113
| Sql
113
114
| Backup
@@ -643,6 +644,9 @@ commandParser conf =
643
644
(metavar " QUERY" <> help " The SQL query" ))
644
645
" Run any SQL query and show result as CSV" )
645
646
647
+ <> command " json" (toParserInfo (pure Json )
648
+ " Show tasks in JSON format" )
649
+
646
650
<> command " ndjson" (toParserInfo (pure Ndjson )
647
651
" Show tasks in NDJSON format" )
648
652
@@ -919,6 +923,7 @@ executeCLiCommand conf now connection = do
919
923
ImportEml -> importEml conf connection
920
924
IngestFile filePath -> ingestFile conf connection filePath
921
925
Csv -> dumpCsv conf
926
+ Json -> dumpJson conf
922
927
Ndjson -> dumpNdjson conf
923
928
Sql -> dumpSql conf
924
929
Backup -> backupDatabase conf
Original file line number Diff line number Diff line change @@ -481,6 +481,14 @@ dumpNdjson conf = do
481
481
fmap (pretty . TL. decodeUtf8 . Aeson. encode) tasks
482
482
483
483
484
+ dumpJson :: Config -> IO (Doc AnsiStyle )
485
+ dumpJson conf = do
486
+ -- TODO: Use Task instead of FullTask to fix broken notes export
487
+ execWithConn conf $ \ connection -> do
488
+ tasks <- (query_ connection " select * from tasks_view" ) :: IO [FullTask ]
489
+ pure $ pretty $ fmap (TL. decodeUtf8 . Aeson. encode) tasks
490
+
491
+
484
492
dumpSql :: Config -> IO (Doc AnsiStyle )
485
493
dumpSql conf = do
486
494
result <- readProcess " sqlite3"
You can’t perform that action at this time.
0 commit comments