@@ -113,9 +113,9 @@ setup _opts@CliOpts{rawopts_=_rawopts, reportspec_=_rspec} _ignoredj = do
113113 when color $
114114 putStrLn $ " Legend: " <> intercalate " , " [
115115 ansiGood " good"
116- ,ansiNeutral " neutral "
117- ,ansiWarning " unknown "
118- ,ansiBad " warning "
116+ ,ansiInfo " info "
117+ ,ansiWarning " warning "
118+ ,ansiProblem " problem "
119119 ]
120120 meconf <- setupHledger
121121 setupTerminal meconf
@@ -449,39 +449,35 @@ supportsColor = (>=! "1.41") -- robust color detection/control (2024)
449449supportsPager = (>=! " 1.41" ) -- use a pager for all output (2024)
450450supportsBashCompletions = (>=! " 1.41" ) -- up to date bash shell completions (2024)
451451
452- -- Status of a setup question/statement: yes, no, unknown.
452+ -- Result of a setup question/statement: yes, no, unknown.
453453data YNU = Y | N | U deriving (Eq )
454454
455- -- Show a status as unstyled english text.
455+ -- Show a setup test result as unstyled english text.
456456instance Show YNU where
457457 show Y = " yes"
458458 show N = " no"
459459 show U = " ?"
460460
461- -- | Print a status , ANSI-styled and emoji-decorated when permitted, using the good/bad styles for Y/N;
462- -- and the (possibly empty) provided message. See also 'w' and 'i' .
461+ -- | Print a setup test result , ANSI-styled and emoji-decorated when permitted,
462+ -- using the good/problem styles for Y/N; and the (possibly empty) provided message.
463463--
464- -- Status is communicated to the user
465- -- 1. as text: "yes"/"no"/"?"
464+ -- In these display helpers (see also 'w' and 'i'):
465+ -- test results are communicated to the user as text: "yes"/"no"/"?".
466466--
467- -- and when colour is permitted,
468- -- 2. in one of four ANSI colours
469- -- 3. with one of four emojis appended, for added distinctiveness in case of colour blindness.
467+ -- Additionally, when colour is permitted, the significance/severity
468+ -- of each test result is communicated,:
470469--
471- -- The emojis chosen are hopefully somewhat likely to render reasonably well even on non-apple machines;
472- -- and if they don't, 1 and 2 will still carry the message.
470+ -- 1. by ANSI-colouring the result text (in green, blue, yellow, or red)
473471--
474- -- Note these things are distinct and not necessarily corresponding, which could be confusing:
475- -- - "good"/"neutral"/"warning"/"bad" test status, in display text & user's perspective
476- -- - ansiGood/ansiNeutral/ansiWarning/ansiBad styles, defined below
477- -- - warn[IO] and error functions defined elsewhere, which apply their own warning and error ANSI styles,
478- -- to (possibly ANSI-styled) text.
472+ -- 2. by appending an emoji, for added distinctiveness in case of colour blindness.
473+ -- The emojis chosen are hopefully somewhat likely to render reasonably well even on non-apple machines;
474+ -- but when they don't, 1 and/or 2 should still be informative.
479475--
480476p :: YNU -> String -> IO ()
481477p status msg = putStrLn $ unwords [" " , showGoodBad status, " " , msg]
482478 where
483479 showGoodBad Y = ansiGood $ " yes" `andIfColour` checkmarkInGreenBoxEmoji
484- showGoodBad N = ansiBad $ " no" `andIfColour` redExclamationMarkEmoji
480+ showGoodBad N = ansiProblem $ " no" `andIfColour` redExclamationMarkEmoji
485481 showGoodBad U = ansiWarning $ " ?" `andIfColour` yellowDiamondEmoji
486482
487483-- | Print a status, ANSI-styled and emoji-decorated when permitted, using the good/warning styles for Y/N;
@@ -496,26 +492,26 @@ w status msg = putStrLn $ unwords ["", showGoodWarn status, "", msg]
496492-- | Print a status, ANSI-styled and emoji-decorated when permitted, using the neutral style for Y/N;
497493-- and the (possibly empty) provided message.
498494i :: YNU -> String -> IO ()
499- i status msg = putStrLn $ unwords [" " , showNeutral status, " " , msg]
495+ i status msg = putStrLn $ unwords [" " , showInfo status, " " , msg]
500496 where
501- showNeutral Y = ansiNeutral $ " yes" `andIfColour` iInBlueBoxEmoji
502- showNeutral N = ansiNeutral $ " no" `andIfColour` iInBlueBoxEmoji
503- showNeutral U = ansiWarning $ " ?" `andIfColour` yellowDiamondEmoji
497+ showInfo Y = ansiInfo $ " yes" `andIfColour` iInBlueBoxEmoji
498+ showInfo N = ansiInfo $ " no" `andIfColour` iInBlueBoxEmoji
499+ showInfo U = ansiWarning $ " ?" `andIfColour` yellowDiamondEmoji
504500
505501-- Apply setup-status-related ANSI styles to text.
506502ansiGood = bold' . brightGreen'
507- ansiNeutral = bold' . brightBlue'
503+ ansiInfo = bold' . brightBlue'
508504ansiWarning = bold' . brightYellow'
509- ansiBad = bold' . brightRed'
505+ ansiProblem = bold' . brightRed'
510506
511507-- Use only reasonably well-supported emojis here.
512508checkmarkInGreenBoxEmoji = " ✅"
513- redExclamationMarkEmoji = " ❗"
514- yellowDiamondEmoji = " 🔸"
515- largeYellowDiamondEmoji = " 🔶"
516509-- This one may render as monochrome in some terminals ?
517510-- Also it seems more likely to be single rather than double width, so a space is added to compensate.
518511iInBlueBoxEmoji = " ℹ️ "
512+ yellowDiamondEmoji = " 🔸"
513+ largeYellowDiamondEmoji = " 🔶"
514+ redExclamationMarkEmoji = " ❗"
519515
520516-- Append a space and the second text, if colour is permitted on stdout (using 'useColorOnStdoutUnsafe').
521517andIfColour a b = a <> if useColorOnStdoutUnsafe then " " <> b else " "
0 commit comments