@@ -1,16 +1,46 @@
6+import Options.Applicative
7+import Paths_stackage (version)
1import Stackage.CompleteBuild
8import Stackage.CompleteBuild
2−import System.Environment (getArgs)
4main :: IO ()
10main :: IO ()
6− args <- getArgs
12+ join (execParser
7− case args of
13+ (info (helpOption <*> versionOption <*> config)
8− [x] | Just y <- lookup x m -> y
14+ (header "Stackage" <>
9− _ -> error $ "Expected one argument, one of: " ++ unwords (map fst m)
15+ fullDesc)))
10− where
16+ where helpOption =
20+ help "Show this help text")
23+ ("fpbuild version " ++ showVersion version)
25+ help "Show fpbuild version")
27+ subparser (mconcat [cmnd completeBuild
12− [ ("nightly", completeBuild Nightly)
29+ "nightly"
30+ "Build, test and upload the Nightly snapshot"
13− , ("lts-major", completeBuild $ LTS Major)
31+ ,cmnd completeBuild
34+ "Build, test and upload the LTS (major) snapshot"
14− , ("lts-minor", completeBuild $ LTS Minor)
35+ ,cmnd completeBuild
38+ "Build, test and upload the LTS (minor) snapshot"
15− , ("check", justCheck)
39+ ,cmnd (const justCheck)
42+ "Just check that the build plan is ok"])
43+ cmnd exec parse name desc =
45+ (info (fmap exec parse)