-
Notifications
You must be signed in to change notification settings - Fork 14
/
main.hs
37 lines (32 loc) · 1.11 KB
/
main.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
--------------------------------------------------------------------
-- |
-- Copyright : (c) Edward Kmett 2017
-- License : BSD2
-- Maintainer: Edward Kmett <ekmett@gmail.com>
-- Stability : experimental
-- Portability: non-portable
--
--------------------------------------------------------------------
module Main where
import Coda.Console
import Coda.Console.Options
import Coda.Server
import Coda.Server.Options
import Coda.Version
import Control.Monad (join)
import Data.Foldable
import Data.Monoid
import Options.Applicative
serverCommand, consoleCommand, commands :: Parser (IO ())
serverCommand = server <$> parseServerOptions
consoleCommand = console <$> parseConsoleOptions
commands = subparser $ fold
[ command "repl" $ info (helper <*> consoleCommand) $
progDesc "Start a REPL"
, command "server" $ info (helper <*> serverCommand) $
progDesc "Begin a language server session"
, command "version" $ info (putStrLn version <$ helper) $
progDesc "Show detailed version information"
]
main :: IO ()
main = join $ execParser $ info (helper <*> commands) $ fullDesc <> progDesc "coda"