1-----------------------------------------------------------------------------
4-- Copyright : (c) Phil Freeman 2013
7-- Maintainer : Phil Freeman <paf31@cantab.net>
8-- Stability : experimental
13-----------------------------------------------------------------------------
17import qualified Language.PureScript as P
18import System.Console.CmdTheLine
19import Control.Applicative
20import Control.Monad (forM)
21import System.Exit (exitSuccess, exitFailure)
22import qualified System.IO.UTF8 as U
24compile :: [FilePath] -> Maybe FilePath -> Maybe FilePath -> IO ()
25compile input output externs = do
26 modules <- fmap (fmap concat . sequence) $ forM input $ \inputFile -> do
27 text <- U.readFile inputFile
28 return $ P.runIndentParser P.parseModules text
38 Right (js, exts, _) -> do
40 Just path -> U.writeFile path js
41 Nothing -> U.putStrLn js
44 Just filePath -> U.writeFile filePath exts
47inputFiles :: Term [FilePath]
48inputFiles = nonEmpty $ posAny [] $ posInfo
49 { posDoc = "The input .ps files" }
51outputFile :: Term (Maybe FilePath)
52outputFile = value $ opt Nothing $ (optInfo [ "o", "output" ])
53 { optDoc = "The output .js file" }
55externsFile :: Term (Maybe FilePath)
56externsFile = value $ opt Nothing $ (optInfo [ "e", "externs" ])
57 { optDoc = "The output .e.ps file" }
60term = compile <$> inputFiles <*> outputFile <*> externsFile
66 , termDoc = "Compiles PureScript to Javascript"
70main = run (term, termInfo)
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list