on 378c7ec help sign in
stackage/app/stackage.hs
75 lines 2.2 kB history raw
1{-# LANGUAGE TupleSections #-}
3module Main where
5import Control.Monad
6import Data.Monoid
7import Data.Version
8import Options.Applicative
9import Paths_stackage (version)
10import Stackage.CompleteBuild
12main :: IO ()
13main =
14 join $
15 execParser $
16 info
17 (helpOption <*> versionOption <*> config)
18 (header "Stackage" <>
19 fullDesc)
20 where
21 helpOption =
22 abortOption ShowHelpText $
23 long "help" <>
24 help "Show this help text"
25 versionOption =
26 infoOption
27 ("fpbuild version " ++ showVersion version)
28 (long "version" <>
29 help "Show fpbuild version")
30 config =
31 subparser $
32 mconcat
33 [ cmnd
34 (uncurry completeBuild)
35 (fmap (Nightly, ) buildFlags)
36 "nightly"
37 "Build, test and upload the Nightly snapshot"
38 , cmnd
39 (uncurry completeBuild)
40 (fmap (LTS Major, ) buildFlags)
41 "lts-major"
42 "Build, test and upload the LTS (major) snapshot"
43 , cmnd
44 (uncurry completeBuild)
45 (fmap (LTS Minor, ) buildFlags)
46 "lts-minor"
47 "Build, test and upload the LTS (minor) snapshot"
48 , cmnd
49 (const justCheck)
50 (pure ())
51 "check"
52 "Just check that the build plan is ok"]
53 cmnd exec parse name desc =
54 command name $
55 info
56 (fmap exec parse)
57 (progDesc desc)
58 buildFlags =
59 BuildFlags <$>
60 fmap
61 not
62 (switch
63 (long "skip-tests" <>
64 help "Skip build and running the test suites")) <*>
65 fmap
66 not
67 (switch
68 (long "skip-upload" <>
69 help "Skip uploading bundle, docs, etc.")) <*>
70 switch
71 (long "enable-library-profiling" <>
72 help "Enable profiling when building") <*>
73 switch
74 (long "verbose" <> short 'v' <>
75 help "Output verbose detail about the build steps")