myriad/app/Main.hs

38 lines
1 KiB
Haskell
Raw Normal View History

2019-07-09 11:19:41 +02:00
module Main where
2021-05-13 06:25:21 +02:00
import System.IO (BufferMode (NoBuffering), hSetBuffering, stdout)
import Options.Applicative
import Myriad
2019-07-09 11:19:41 +02:00
2019-07-11 07:00:41 +02:00
data Args = Args
2020-06-17 04:02:12 +02:00
{ configPath :: FilePath
, languagesDir :: FilePath
2019-07-11 07:00:41 +02:00
}
parseArgs :: IO Args
parseArgs = execParser $ info (helper <*> args) (fullDesc <> progDesc "Run the Myriad server")
where
args = Args
<$> option str (mconcat
[ long "config"
, short 'c'
2020-06-17 04:02:12 +02:00
, help "Set the myriad configuration"
, metavar "PATH"
, value "./config.yaml"
2019-09-05 16:17:20 +02:00
, showDefault
])
<*> 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-07-11 07:00:41 +02:00
2019-07-09 11:19:41 +02:00
main :: IO ()
main = do
2021-05-13 06:25:21 +02:00
hSetBuffering stdout NoBuffering
2020-06-17 04:02:12 +02:00
Args { configPath, languagesDir } <- parseArgs
runMyriadServer configPath languagesDir