2019-07-09 11:19:41 +02:00
|
|
|
module Main where
|
|
|
|
|
2019-07-11 07:00:41 +02:00
|
|
|
import qualified Data.Text as T
|
|
|
|
|
2019-07-23 07:24:02 +02:00
|
|
|
import Options.Applicative
|
2019-07-09 11:19:41 +02:00
|
|
|
|
2019-07-23 07:24:02 +02:00
|
|
|
import Myriad
|
2019-07-09 11:19:41 +02:00
|
|
|
|
2019-07-11 07:00:41 +02:00
|
|
|
data Args = Args
|
|
|
|
{ configInput :: T.Text
|
2019-09-05 16:17:08 +02:00
|
|
|
, languagesDir :: T.Text
|
2019-07-11 07:00:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
parseArgs :: IO Args
|
|
|
|
parseArgs = execParser $ info (helper <*> args) (fullDesc <> progDesc "Run the Myriad server")
|
|
|
|
where
|
2019-09-05 16:17:08 +02:00
|
|
|
args = Args
|
|
|
|
<$> option str (mconcat
|
|
|
|
[ long "config"
|
|
|
|
, short 'c'
|
|
|
|
, help "Set the Dhall configuration"
|
|
|
|
, metavar "DHALL"
|
2019-09-05 16:17:20 +02:00
|
|
|
, value "./config.dhall"
|
|
|
|
, showDefault
|
2019-09-05 16:17:08 +02:00
|
|
|
])
|
|
|
|
<*> option str (mconcat
|
|
|
|
[ long "languages"
|
|
|
|
, short 'l'
|
|
|
|
, help "Set the languages directory"
|
|
|
|
, metavar "DIR"
|
2019-09-05 16:17:20 +02:00
|
|
|
, value "./languages/"
|
|
|
|
, showDefault
|
2019-09-05 16:17:08 +02:00
|
|
|
])
|
2019-07-11 07:00:41 +02:00
|
|
|
|
2019-07-09 11:19:41 +02:00
|
|
|
main :: IO ()
|
|
|
|
main = do
|
2019-09-05 16:17:08 +02:00
|
|
|
Args { configInput, languagesDir } <- parseArgs
|
|
|
|
runMyriadServer configInput languagesDir
|