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