diff --git a/hledger-lib/Hledger/Reports/ReportOptions.hs b/hledger-lib/Hledger/Reports/ReportOptions.hs index 665829c0d..a7f087ac8 100644 --- a/hledger-lib/Hledger/Reports/ReportOptions.hs +++ b/hledger-lib/Hledger/Reports/ReportOptions.hs @@ -230,7 +230,7 @@ rawOptsToReportOpts d rawopts = let formatstring = T.pack <$> maybestringopt "format" rawopts querystring = map T.pack $ listofstringopt "args" rawopts -- doesn't handle an arg like "" right - pretty = fromMaybe False $ alwaysneveropt "pretty" rawopts + pretty = fromMaybe False $ ynopt "pretty" rawopts format = case parseStringFormat <$> formatstring of Nothing -> defaultBalanceLineFormat @@ -329,8 +329,8 @@ balancecalcopt = balanceaccumopt :: RawOpts -> BalanceAccumulation balanceaccumopt = fromMaybe PerPeriod . balanceAccumulationOverride -alwaysneveropt :: String -> RawOpts -> Maybe Bool -alwaysneveropt opt rawopts = case maybestringopt opt rawopts of +ynopt :: String -> RawOpts -> Maybe Bool +ynopt opt rawopts = case maybestringopt opt rawopts of Just "always" -> Just True Just "yes" -> Just True Just "y" -> Just True diff --git a/hledger-lib/Hledger/Utils/IO.hs b/hledger-lib/Hledger/Utils/IO.hs index 28309689e..09bbbebb3 100644 --- a/hledger-lib/Hledger/Utils/IO.hs +++ b/hledger-lib/Hledger/Utils/IO.hs @@ -360,8 +360,8 @@ useColorOnHandle h = unsafePerformIO $ do no_color <- isJust <$> lookupEnv "NO_COLOR" supports_color <- hSupportsANSIColor h let coloroption = colorOption - return $ coloroption `elem` ["always","yes"] - || (coloroption `notElem` ["never","no"] && not no_color && supports_color) + return $ coloroption `elem` ["always","yes","y"] + || (coloroption `notElem` ["never","no","n"] && not no_color && supports_color) -- | Wrap a string in ANSI codes to set and reset foreground colour. -- ColorIntensity is @Dull@ or @Vivid@ (ie normal and bold).