quotes-api/importer/Main.hs

24 lines
496 B
Haskell
Raw Normal View History

2023-04-13 21:43:39 +00:00
module Main where
import Options.Applicative
import qualified Data.ByteString.Lazy as BSL
import Config
import Database
import qualified Parsers.Readwise as RW
runImporter :: FilePath -> FilePath -> IO ()
runImporter db rw = do
x <- BSL.readFile rw
let y = RW.parse x
case y of
Left err -> print err
Right qts -> insertQts db qts
main :: IO ()
main = do
conf <- execParser importerParserOpts
initDb (ioAppDbFile conf)
runImporter (ioAppDbFile conf) (ioReadwiseFile conf)