@@ -31,7 +31,8 @@ import Pantry (loadSnapshot)
31
31
import Path
32
32
import qualified RIO.Map as Map
33
33
import RIO.Process (envVarsL )
34
- import Stack.Config (makeConcreteResolver , getProjectConfig , getImplicitGlobalProjectDir )
34
+ import Stack.Config (makeConcreteResolver , getProjectConfig ,
35
+ getImplicitGlobalProjectDir )
35
36
import Stack.Constants
36
37
import Stack.Types.Config
37
38
import Stack.Types.Resolver
@@ -82,7 +83,8 @@ cfgCmdSet cmd = do
82
83
if config' == config
83
84
then logInfo
84
85
(fromString (toFilePath configFilePath) <>
85
- " already contained the intended configuration and remains unchanged." )
86
+ " already contained the intended configuration and remains \
87
+ \unchanged." )
86
88
else do
87
89
let configLines = yamlLines rawConfig
88
90
either
@@ -125,60 +127,67 @@ cfgCmdEnvName :: String
125
127
cfgCmdEnvName = " env"
126
128
127
129
configCmdSetParser :: OA. Parser ConfigCmdSet
128
- configCmdSetParser =
129
- OA. hsubparser $
130
- mconcat
131
- [ OA. command
132
- " resolver"
133
- (OA. info
134
- (ConfigCmdSetResolver <$>
135
- OA. argument
136
- readAbstractResolver
137
- (OA. metavar " RESOLVER" <>
138
- OA. help " E.g. \" nightly\" or \" lts-7.2\" " ))
139
- (OA. progDesc
140
- " Change the resolver of the current project. See https://docs.haskellstack.org/en/stable/yaml_configuration/#resolver for more info." ))
141
- , OA. command
142
- (T. unpack configMonoidSystemGHCName)
143
- (OA. info
144
- (ConfigCmdSetSystemGhc <$> scopeFlag <*> boolArgument)
145
- (OA. progDesc
146
- " Configure whether stack should use a system GHC installation or not." ))
147
- , OA. command
148
- (T. unpack configMonoidInstallGHCName)
149
- (OA. info
150
- (ConfigCmdSetInstallGhc <$> scopeFlag <*> boolArgument)
151
- (OA. progDesc
152
- " Configure whether stack should automatically install GHC when necessary." ))
153
- ]
130
+ configCmdSetParser = OA. hsubparser $
131
+ mconcat
132
+ [ OA. command " resolver"
133
+ ( OA. info
134
+ (ConfigCmdSetResolver <$>
135
+ OA. argument
136
+ readAbstractResolver
137
+ (OA. metavar " SNAPSHOT" <>
138
+ OA. help " E.g. \" nightly\" or \" lts-7.2\" " ))
139
+ (OA. progDesc
140
+ " Change the resolver of the current project." ))
141
+ , OA. command (T. unpack configMonoidSystemGHCName)
142
+ ( OA. info
143
+ (ConfigCmdSetSystemGhc <$> scopeFlag <*> boolArgument)
144
+ (OA. progDesc
145
+ " Configure whether Stack should use a system GHC installation \
146
+ \or not." ))
147
+ , OA. command (T. unpack configMonoidInstallGHCName)
148
+ ( OA. info
149
+ (ConfigCmdSetInstallGhc <$> scopeFlag <*> boolArgument)
150
+ (OA. progDesc
151
+ " Configure whether Stack should automatically install GHC when \
152
+ \necessary." ))
153
+ ]
154
154
155
155
scopeFlag :: OA. Parser CommandScope
156
- scopeFlag =
157
- OA. flag
158
- CommandScopeProject
159
- CommandScopeGlobal
160
- (OA. long " global" <>
161
- OA. help
162
- " Modify the global configuration (typically at \" ~/.stack/config.yaml\" ) instead of the project stack.yaml." )
156
+ scopeFlag = OA. flag
157
+ CommandScopeProject
158
+ CommandScopeGlobal
159
+ ( OA. long " global"
160
+ <> OA. help
161
+ " Modify the user-specific global configuration file ('config.yaml') \
162
+ \instead of the project-level configuration file ('stack.yaml')."
163
+ )
163
164
164
165
readBool :: OA. ReadM Bool
165
166
readBool = do
166
- s <- OA. readerAsk
167
- case s of
168
- " true" -> return True
169
- " false" -> return False
170
- _ -> OA. readerError (" Invalid value " ++ show s ++ " : Expected \" true\" or \" false\" " )
167
+ s <- OA. readerAsk
168
+ case s of
169
+ " true" -> return True
170
+ " false" -> return False
171
+ _ -> OA. readerError (" Invalid value " ++ show s ++
172
+ " : Expected \" true\" or \" false\" " )
171
173
172
174
boolArgument :: OA. Parser Bool
173
- boolArgument = OA. argument readBool (OA. metavar " true|false" <> OA. completeWith [" true" , " false" ])
175
+ boolArgument = OA. argument
176
+ readBool
177
+ ( OA. metavar " true|false"
178
+ <> OA. completeWith [" true" , " false" ]
179
+ )
174
180
175
181
configCmdEnvParser :: OA. Parser EnvSettings
176
182
configCmdEnvParser = EnvSettings
177
183
<$> boolFlags True " locals" " include local package information" mempty
178
- <*> boolFlags True " ghc-package-path" " set GHC_PACKAGE_PATH variable" mempty
184
+ <*> boolFlags True
185
+ " ghc-package-path" " set GHC_PACKAGE_PATH environment variable" mempty
179
186
<*> boolFlags True " stack-exe" " set STACK_EXE environment variable" mempty
180
- <*> boolFlags False " locale-utf8" " set the GHC_CHARENC environment variable to UTF8" mempty
181
- <*> boolFlags False " keep-ghc-rts" " keep any GHC_RTS environment variables" mempty
187
+ <*> boolFlags False
188
+ " locale-utf8" " set the GHC_CHARENC environment variable to UTF-8" mempty
189
+ <*> boolFlags False
190
+ " keep-ghc-rts" " keep any GHCRTS environment variable" mempty
182
191
183
192
data EnvVarAction = EVASet ! Text | EVAUnset
184
193
deriving Show
0 commit comments