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