forked from commercialhaskell/stack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGhciParser.hs
More file actions
60 lines (58 loc) · 3.19 KB
/
GhciParser.hs
File metadata and controls
60 lines (58 loc) · 3.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
module Stack.Options.GhciParser where
import Options.Applicative
import Options.Applicative.Args
import Options.Applicative.Builder.Extra
import Stack.Config (packagesParser)
import Stack.Ghci (GhciOpts (..))
import Stack.Options.BuildParser (flagsParser)
import Stack.Options.Completion
import Stack.Prelude
-- | Parser for GHCI options
ghciOptsParser :: Parser GhciOpts
ghciOptsParser = GhciOpts
<$> many
(textArgument
(metavar "TARGET/FILE" <>
completer (targetCompleter <> fileExtCompleter [".hs", ".lhs"]) <>
help ("If none specified, use all local packages. " <>
"See https://docs.haskellstack.org/en/stable/build_command/#target-syntax for details. " <>
"If a path to a .hs or .lhs file is specified, it will be loaded.")))
<*> ((\x y -> x ++ concat y)
<$> flag
[]
["-Wall", "-Werror"]
(long "pedantic" <> help "Turn on -Wall and -Werror")
<*> many (argsOption (long "ghci-options" <>
metavar "OPTIONS" <>
completer ghcOptsCompleter <>
help "Additional options passed to GHCi"))
)
<*> (concat <$> many
(argsOption
(long "ghc-options" <>
metavar "OPTIONS" <>
completer ghcOptsCompleter <>
help "Additional options passed to both GHC and GHCi")))
<*> flagsParser
<*> optional
(strOption (long "with-ghc" <>
metavar "GHC" <>
help "Use this GHC to run GHCi"))
<*> (not <$> boolFlags True "load" "load modules on start-up" idm)
<*> packagesParser
<*> optional
(textOption
(long "main-is" <>
metavar "TARGET" <>
completer targetCompleter <>
help "Specify which target should contain the main \
\module to load, such as for an executable for \
\test suite or benchmark."))
<*> switch (long "load-local-deps" <> help "Load all local dependencies of your targets")
-- TODO: deprecate this? probably useless.
<*> switch (long "skip-intermediate-deps" <> help "Skip loading intermediate target dependencies" <> internal)
<*> optional (boolFlagsNoDefault "package-hiding" "package hiding" idm)
<*> switch (long "no-build" <> help "Don't build before launching GHCi" <> internal)
<*> switch (long "only-main" <> help "Only load and import the main module. If no main module, no modules will be loaded.")