Add an importer binary.

This commit is contained in:
Dhananjay Balan
2023-04-13 23:43:39 +02:00
parent 11c4e92cc7
commit 72b3e38980
6 changed files with 117 additions and 16 deletions

View File

@@ -2,6 +2,8 @@
module Config
( parserOpts
, AppConfig(..)
, importerParserOpts
, ImporterConfig(..)
) where
import Options.Applicative
@@ -43,3 +45,29 @@ parserOpts = info (appConfig <**> helper)
( fullDesc
<> progDesc "Serve Quotes API"
<> header "quotes api" )
data ImporterConfig = ImporterConfig
{ ioAppDbFile :: FilePath
, ioReadwiseFile :: FilePath
} deriving (Show, Eq)
importerConfig :: Parser ImporterConfig
importerConfig = ImporterConfig
<$> strOption
( long "dbpath"
<> help "sqlite db file path"
<> showDefault
<> value "quotes.db"
<> metavar "TARGET")
<*> strOption
( long "readwise"
<> help "readwise export file path"
<> showDefault
<> value "readwise.csv"
<> metavar "RWCSV")
importerParserOpts :: ParserInfo ImporterConfig
importerParserOpts = info (importerConfig <**> helper)
( fullDesc
<> progDesc "Import data into db"
<> header "importer API")