supporting "lang" command.
This commit is contained in:
parent
bb07f52a8a
commit
4202ca1ea2
@ -5,6 +5,7 @@ import Check
|
|||||||
import Control.Exception hiding (try)
|
import Control.Exception hiding (try)
|
||||||
import List
|
import List
|
||||||
import Param
|
import Param
|
||||||
|
import Lang
|
||||||
import Prelude hiding (catch)
|
import Prelude hiding (catch)
|
||||||
import System.Console.GetOpt
|
import System.Console.GetOpt
|
||||||
import System.Environment (getArgs)
|
import System.Environment (getArgs)
|
||||||
@ -63,6 +64,7 @@ main = flip catch handler $ do
|
|||||||
"browse" -> browseModule opt (cmdArg !! 1)
|
"browse" -> browseModule opt (cmdArg !! 1)
|
||||||
"list" -> listModules opt
|
"list" -> listModules opt
|
||||||
"check" -> checkSyntax opt (cmdArg !! 1)
|
"check" -> checkSyntax opt (cmdArg !! 1)
|
||||||
|
"lang" -> listLanguages opt
|
||||||
_ -> error usage
|
_ -> error usage
|
||||||
putStr res
|
putStr res
|
||||||
where
|
where
|
||||||
|
14
Lang.hs
Normal file
14
Lang.hs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
module Lang where
|
||||||
|
|
||||||
|
import Control.Applicative
|
||||||
|
import Param
|
||||||
|
import System.IO
|
||||||
|
import System.Process
|
||||||
|
|
||||||
|
listLanguages :: Options -> IO String
|
||||||
|
listLanguages opt = convert opt . lines <$> getLangs opt
|
||||||
|
|
||||||
|
getLangs :: Options -> IO String
|
||||||
|
getLangs opt = do
|
||||||
|
(_,hout,_,_) <- runInteractiveProcess (ghc opt) ["--supported-languages"] Nothing Nothing
|
||||||
|
hGetContents hout
|
Loading…
Reference in New Issue
Block a user