@@ -8,6 +8,7 @@ module Main (main) where
88
99import Data.Traversable (for)
1010import Data.Version (showVersion)
11+import Data.Monoid ((<>))
1112
1213import Control.Applicative
1314import Control.Monad
@@ -24,7 +25,8 @@ import System.Directory (createDirectoryIfMissing)
2425
2526import Language.PureScript.Bundle
2627
27−import Options.Applicative as Opts
28+import Options.Applicative (Parser, ParseError (..))
29+import qualified Options.Applicative as Opts
2830
2931import qualified Paths_purescript as Paths
3032
@@ -64,41 +66,41 @@ options = Options <$> some inputFile
6466 <*> namespace
6567 where
6668 inputFile :: Parser FilePath
67− inputFile = strArgument $
68− metavar "FILE"
69− <> help "The input .js file(s)"
69+ inputFile = Opts.strArgument $
70+ Opts.metavar "FILE"
71+ <> Opts.help "The input .js file(s)"
7072
7173 outputFile :: Parser FilePath
72− outputFile = strOption $
73− short 'o'
74− <> long "output"
75− <> help "The output .js file"
74+ outputFile = Opts.strOption $
75+ Opts.short 'o'
76+ <> Opts.long "output"
77+ <> Opts.help "The output .js file"
7678
7779 entryPoint :: Parser String
78− entryPoint = strOption $
79− short 'm'
80− <> long "module"
81− <> help "Entry point module name(s). All code which is not a transitive dependency of an entry point module will be removed."
80+ entryPoint = Opts.strOption $
81+ Opts.short 'm'
82+ <> Opts.long "module"
83+ <> Opts.help "Entry point module name(s). All code which is not a transitive dependency of an entry point module will be removed."
8284
8385 mainModule :: Parser String
84− mainModule = strOption $
85− long "main"
86− <> help "Generate code to run the main method in the specified module."
86+ mainModule = Opts.strOption $
87+ Opts.long "main"
88+ <> Opts.help "Generate code to run the main method in the specified module."
8789
8890 namespace :: Parser String
89− namespace = strOption $
90− short 'n'
91− <> long "namespace"
91+ namespace = Opts.strOption $
92+ Opts.short 'n'
93+ <> Opts.long "namespace"
9294 <> Opts.value "PS"
93− <> showDefault
94− <> help "Specify the namespace that PureScript modules will be exported to when running in the browser."
95+ <> Opts.showDefault
96+ <> Opts.help "Specify the namespace that PureScript modules will be exported to when running in the browser."
9597
9698-- | Make it go.
9799main :: IO ()
98100main = do
99101 hSetEncoding stdout utf8
100102 hSetEncoding stderr utf8
101− opts <- execParser (info (version <*> helper <*> options) infoModList)
103+ opts <- Opts.execParser (Opts.info (version <*> Opts.helper <*> options) infoModList)
102104 output <- runExceptT (app opts)
103105 case output of
104106 Left err -> do
@@ -111,9 +113,10 @@ main = do
111113 writeFile outputFile js
112114 Nothing -> putStrLn js
113115 where
114− infoModList = fullDesc <> headerInfo <> footerInfo
115− headerInfo = header "psc-bundle - Bundles compiled PureScript modules for the browser"
116− footerInfo = footer $ "psc-bundle " ++ showVersion Paths.version
116+ infoModList = Opts.fullDesc <> headerInfo <> footerInfo
117+ headerInfo = Opts.header "psc-bundle - Bundles compiled PureScript modules for the browser"
118+ footerInfo = Opts.footer $ "psc-bundle " ++ showVersion Paths.version
117119
118120 version :: Parser (a -> a)
119− version = abortOption (InfoMsg (showVersion Paths.version)) $ long "version" <> help "Show the version number" <> hidden
121+ version = Opts.abortOption (InfoMsg (showVersion Paths.version)) $
122+ Opts.long "version" <> Opts.help "Show the version number" <> Opts.hidden