4
4
5
5
{-|
6
6
Module : Stack.Options.Completion
7
+ Description : Completers for command line arguments.
7
8
License : BSD-3-Clause
9
+
10
+ Completers for command line arguments or arguments of command line options.
8
11
-}
9
12
10
13
module Stack.Options.Completion
@@ -38,6 +41,7 @@ import Stack.Types.ProjectConfig ( ProjectConfig (..) )
38
41
import Stack.Types.NamedComponent ( renderPkgComponent )
39
42
import Stack.Types.SourceMap ( SMWanted (.. ), ppComponents , ppGPD )
40
43
44
+ -- | A completer for @--ghc-options@ or @--ghci-options@.
41
45
ghcOptsCompleter :: Completer
42
46
ghcOptsCompleter = mkCompleter $ \ inputRaw -> pure $
43
47
let input = unescapeBashArg inputRaw
@@ -67,6 +71,7 @@ buildConfigCompleter inner = mkCompleter $ \inputRaw -> do
67
71
let go = go' { logLevel = LevelOther " silent" }
68
72
withRunnerGlobal go $ withConfig NoReexec $ withDefaultEnvConfig $ inner input
69
73
74
+ -- | A completer for components of project packages.
70
75
targetCompleter :: Completer
71
76
targetCompleter = buildConfigCompleter $ \ input -> do
72
77
packages <- view $ buildConfigL . to (. smWanted. project)
@@ -79,6 +84,7 @@ targetCompleter = buildConfigCompleter $ \input -> do
79
84
allComponentNames (name, comps) =
80
85
map (T. unpack . renderPkgComponent . (name,)) (Set. toList comps)
81
86
87
+ -- | A completer for Cabal flags of project packages.
82
88
flagCompleter :: Completer
83
89
flagCompleter = buildConfigCompleter $ \ input -> do
84
90
bconfig <- view buildConfigL
@@ -111,6 +117,7 @@ flagCompleter = buildConfigCompleter $ \input -> do
111
117
(' *' : _) -> wildcardFlags
112
118
_ -> normalFlags
113
119
120
+ -- | A completer for executable components of project packages.
114
121
projectExeCompleter :: Completer
115
122
projectExeCompleter = buildConfigCompleter $ \ input -> do
116
123
packages <- view $ buildConfigL . to (. smWanted. project)
0 commit comments