supporting "lang" command.
This commit is contained in:
parent
bb07f52a8a
commit
4202ca1ea2
@ -5,6 +5,7 @@ import Check
|
||||
import Control.Exception hiding (try)
|
||||
import List
|
||||
import Param
|
||||
import Lang
|
||||
import Prelude hiding (catch)
|
||||
import System.Console.GetOpt
|
||||
import System.Environment (getArgs)
|
||||
@ -63,6 +64,7 @@ main = flip catch handler $ do
|
||||
"browse" -> browseModule opt (cmdArg !! 1)
|
||||
"list" -> listModules opt
|
||||
"check" -> checkSyntax opt (cmdArg !! 1)
|
||||
"lang" -> listLanguages opt
|
||||
_ -> error usage
|
||||
putStr res
|
||||
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