diff --git a/ChangeLog.md b/ChangeLog.md index 9ed2097d07..3df0789df1 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -57,6 +57,9 @@ Other enhancements: non-project-specific yaml configuration parameter, allows a stack user to redefine the default styles that stack uses to color some of its output. See `stack --help` for more information. +* British English spelling of 'color' (colour) accepted as an alias for + `--color`, `--stack-colors`, `stack ls stack-colors` at the command line and + for `color:` and `stack-colors:` in yaml configuration files. * New build option `--ddump-dir`. (See [#4225](https://github.com/commercialhaskell/stack/issues/4225)) * Stack parses and respects the `preferred-versions` information from Hackage for choosing latest version of a package in some cases, diff --git a/doc/yaml_configuration.md b/doc/yaml_configuration.md index 10b380c5ce..eba975a401 100644 --- a/doc/yaml_configuration.md +++ b/doc/yaml_configuration.md @@ -955,6 +955,9 @@ The color use can also be set at the command line using the equivalent `--color=` global option. Color use set at the command line takes precedence over that set in a yaml configuration file. +(The British English spelling (colour) is also accepted. In yaml configuration +files, the American spelling is the alternative that has priority.) + ### stack-colors Stack uses styles to format some of its output. The default styles do not work @@ -983,4 +986,9 @@ terminal theme might wish to set the styles as follows: ```yaml stack-colors: error=31:good=32:shell=35:dir=34:recommendation=32:target=95:module=35:package-component=95 ``` -The styles can also be set at the command line using the equivalent `--stack-colors=` global option. Styles set at the command line take precedence over those set in a yaml configuration file. +The styles can also be set at the command line using the equivalent `--stack-colors=` +global option. Styles set at the command line take precedence over those set in +a yaml configuration file. + +(The British English spelling (colour) is also accepted. In yaml configuration +files, the American spelling is the alternative that has priority.) diff --git a/src/Stack/Ls.hs b/src/Stack/Ls.hs index 0f9405555f..4694db5640 100644 --- a/src/Stack/Ls.hs +++ b/src/Stack/Ls.hs @@ -132,7 +132,14 @@ lsStylesCmd :: OA.Mod OA.CommandFields LsCmds lsStylesCmd = OA.command "stack-colors" - (OA.info lsStylesOptsParser (OA.progDesc "View stack's output styles")) + (OA.info lsStylesOptsParser + (OA.progDesc "View stack's output styles")) + <> + OA.command + "stack-colours" + (OA.info lsStylesOptsParser + (OA.progDesc "View stack's output styles (alias for \ + \'stack-colors')")) data Snapshot = Snapshot { snapId :: Text diff --git a/src/Stack/Options/ConfigParser.hs b/src/Stack/Options/ConfigParser.hs index 36ef92ad45..5270784336 100644 --- a/src/Stack/Options/ConfigParser.hs +++ b/src/Stack/Options/ConfigParser.hs @@ -145,6 +145,7 @@ configOptsParser currentDir hide0 = hide) <*> optionalFirst (option readColorWhen ( long "color" + <> long "colour" <> metavar "WHEN" <> completeWith ["always", "never", "auto"] <> help "Specify when to use color in output; WHEN is 'always', \ diff --git a/src/Stack/Options/GlobalParser.hs b/src/Stack/Options/GlobalParser.hs index 997fbcdfe7..19c8ed7c4d 100644 --- a/src/Stack/Options/GlobalParser.hs +++ b/src/Stack/Options/GlobalParser.hs @@ -36,6 +36,7 @@ globalOptsParser currentDir kind defLogLevel = hide <*> option readStyles (long "stack-colors" <> + long "stack-colours" <> metavar "STYLES" <> value mempty <> help "Specify stack's output styles; STYLES is a colon-delimited \ diff --git a/src/Stack/Types/Config.hs b/src/Stack/Types/Config.hs index 4dced8f446..245c11d496 100644 --- a/src/Stack/Types/Config.hs +++ b/src/Stack/Types/Config.hs @@ -854,8 +854,16 @@ parseConfigMonoidObject rootDir obj = do configMonoidDumpLogs <- First <$> obj ..:? configMonoidDumpLogsName configMonoidSaveHackageCreds <- First <$> obj ..:? configMonoidSaveHackageCredsName configMonoidHackageBaseUrl <- First <$> obj ..:? configMonoidHackageBaseUrlName - configMonoidColorWhen <- First <$> obj ..:? configMonoidColorWhenName - configMonoidStyles <- fromMaybe mempty <$> obj ..:? configMonoidStylesName + + configMonoidColorWhenUS <- obj ..:? configMonoidColorWhenUSName + configMonoidColorWhenGB <- obj ..:? configMonoidColorWhenGBName + let configMonoidColorWhen = First $ configMonoidColorWhenUS + <|> configMonoidColorWhenGB + + configMonoidStylesUS <- obj ..:? configMonoidStylesUSName + configMonoidStylesGB <- obj ..:? configMonoidStylesGBName + let configMonoidStyles = fromMaybe mempty $ configMonoidStylesUS + <|> configMonoidStylesGB return ConfigMonoid {..} where @@ -998,11 +1006,17 @@ configMonoidSaveHackageCredsName = "save-hackage-creds" configMonoidHackageBaseUrlName :: Text configMonoidHackageBaseUrlName = "hackage-base-url" -configMonoidColorWhenName :: Text -configMonoidColorWhenName = "color" +configMonoidColorWhenUSName :: Text +configMonoidColorWhenUSName = "color" + +configMonoidColorWhenGBName :: Text +configMonoidColorWhenGBName = "colour" + +configMonoidStylesUSName :: Text +configMonoidStylesUSName = "stack-colors" -configMonoidStylesName :: Text -configMonoidStylesName = "stack-colors" +configMonoidStylesGBName :: Text +configMonoidStylesGBName = "stack-colours" data ConfigException = ParseConfigFileException (Path Abs File) ParseException