Simon Michael
aefa4e8f20
imp:cli: show first line of error messages in red
...
error' and usageError now redden and bolden the first line of error
messages, when ANSI codes are supported and permitted.
And warn goldens and boldens the first line of warning messages.
2024-12-20 08:51:38 -10:00
Simon Michael
05ae105b42
dev: Hledger.Utils.IO: warn
2024-12-03 16:07:54 -10:00
Simon Michael
5d2259d942
dev: Hledger.Utils.IO: cleanup
2024-11-02 12:59:44 -10:00
Simon Michael
1dabccfb46
dev: Hledger.Utils.IO: more cleanup
2024-11-02 12:51:53 -10:00
Simon Michael
4351304f06
dev: Hledger.Utils.IO: cleanup
2024-11-02 12:04:19 -10:00
Simon Michael
9c81bb2a06
dev: Hledger.Utils.IO colour helpers: cleanup
2024-11-02 11:54:28 -10:00
Simon Michael
657fc1551f
!fix: respect --color=yes in a few places that didn't; drop text-ansi dep
...
Hledger.Utils.IO's ansi style/color helpers now respect --color=yes,
so that eg `hledger --color=yes | less -R` shows bold headings as
you'd expect.
Hledger.Utils.IO.rgb' now takes Float arguments instead of Word8.
2024-11-01 10:40:25 -10:00
Simon Michael
234b4879c2
imp: less pager will use HLEDGER_LESS instead, if defined
...
When using `less` as pager, if HLEDGER_LESS is defined, it will
provide the options (instead of LESS + hledger's extra options).
You can set your own preferred options here, or you can set it
equal to LESS to use exactly those options.
[#2272 ]-related
2024-11-01 08:02:03 -10:00
Simon Michael
5bab9600e4
imp: simplify pager setup: just customise LESS, not MORE
...
[#2272 ]-related
2024-11-01 08:01:44 -10:00
Simon Michael
1011029356
imp: pager set extra LESS options for a nice experience when using less
...
Currently this sets a rather ambitious set of options,
and overrides the existing LESS:
--chop-long-lines
--hilite-unread
--ignore-case
--mouse
--no-init
--QUIT-AT-EOF
--quit-if-one-screen
--RAW-CONTROL-CHARS
--squeeze-blank-lines
--use-backslash
--use-color
2024-10-31 19:13:39 -10:00
Simon Michael
30086ae249
imp: run pager more robustly; drop pager lib [ #2272 ]
...
This fixes the error displayed when quitting the pager with long output.
It also replaces the pager lib with more robust homegrown pager utilities,
which should prevent a number of failure modes.
2024-10-31 18:55:09 -10:00
Simon Michael
f8cc9cdb4d
;dev: document runPager's behaviour precisely
2024-10-20 08:10:07 -10:00
Simon Michael
f5b10b2d40
dev: cleanups
2024-10-19 16:56:14 -10:00
Simon Michael
b940254025
imp:cli: detect --color more safely in most cases
...
--color now also works in a config file, like --pager, except for two
cases: it does not affect colouring of debug output, or the colouring
helpers used in the check recentassertions error message.
2024-10-19 16:28:36 -10:00
Simon Michael
711d921774
imp:cli: --no-pager -> --pager, make this and --color safe options
2024-10-19 16:28:36 -10:00
Simon Michael
3e48451c3f
imp: note unsafe args / config file limitation; make --no-pager safe
2024-10-19 16:28:36 -10:00
Simon Michael
ba786752d1
imp 📟 add a --no-pager general flag
2024-10-19 16:28:36 -10:00
Simon Michael
db748465a8
fix 📟 when the $PAGER is not in PATH, print instead of failing
2024-10-19 16:28:36 -10:00
Simon Michael
4441680d7b
fix:lib:Hledger.Utils.IO.pager: avoid a crash; avoid an extra newline
2024-10-19 16:28:36 -10:00
Simon Michael
3b7420b97c
feat: use a pager for all large terminal output, not just for help
2024-10-19 16:28:36 -10:00
Simon Michael
49c4ccd0b7
dev: Hledger.Utils.IO: fix hlint warnings
2024-06-25 07:45:27 +01:00
Simon Michael
1fe7e7af8c
imp: cli: --color now also accepts y or n, like --pretty
2024-05-29 09:37:20 -10:00
Simon Michael
e6b3fa0f54
dev:IO: comments
2024-02-22 07:32:10 -10:00
Simon Michael
d1635a55f8
lib: move readFileStrictly to Hledger.Utils.IO
2023-12-07 03:41:31 -10:00
Simon Michael
7899b992b7
fix: prevent a Glob/filemanip package conflict in IO.hs
2023-12-05 17:43:04 -10:00
Simon Michael
ddae3af8a3
lib: Hledger.Utils.IO: added expandGlob, sortByModTime
2023-05-19 09:09:21 -10:00
Simon Michael
3d2ef21081
lib: Hledger.Utils.IO: more robust monochrome pretty/debug printing
2023-05-18 07:19:36 -10:00
Simon Michael
83de76b67a
lib: Hledger.Utils.IO: avoid excessively wide "compact" prettyprinting
2023-05-18 07:19:36 -10:00
Simon Michael
1de8600067
imp: cli: try to ensure less (and its more mode) show ANSI ( fix #2015 )
...
If you use some other $PAGER, you will have to configure it to show
ANSI yourself (or disable ANSI, eg by setting NO_COLOR=1).
2023-04-06 11:13:00 -10:00
Simon Michael
c661fa7763
dev: lib: refactor pager
2023-04-06 11:12:56 -10:00
Simon Michael
c2ab616c2d
dev: unbreak recent change, don't re-export Color/ColorIntensity for now
2023-03-18 20:19:50 -10:00
Simon Michael
be8e64e498
imp: lib: export more terminal size, ANSI style/color helpers
...
Hledger.Utils.IO (and therefore Hledger and Hledger.Cli.Script) added:
getTerminalHeightWidth
getTerminalHeight
getTerminalWidth
Color(..)
ColorIntensity(..)
bold'
faint'
black'
red'
green'
yellow'
blue'
magenta'
cyan'
white'
brightBlack'
brightRed'
brightGreen'
brightYellow'
brightBlue'
brightMagenta'
brightCyan'
brightWhite'
rgb'
2023-03-18 19:59:00 -10:00
Simon Michael
5ddb6028ed
;dev: lib: cleanup
2023-03-16 21:52:37 -10:00
Simon Michael
6dc91588e4
fix: lib: avoid using pager on Windows, part 2
2023-03-10 20:58:11 -10:00
Simon Michael
41e838ef83
fix: lib: avoid using pager on Windows, the package is not supported
2023-03-10 19:14:13 -10:00
Simon Michael
9381b46004
fix: lib: fix terminal lightness detection
2023-01-27 16:51:05 -10:00
Simon Michael
79914cbe74
fix: cli: avoid showing color detection escape sequence when piped
2023-01-27 10:50:56 -10:00
Simon Michael
110711a2a2
fix: cli: restore workaround to avoid showing escape codes in emacs
2023-01-27 10:00:07 -10:00
Simon Michael
eed8a06906
fix: cli: don't highlight help when TERM=dumb
2023-01-27 06:06:17 -10:00
Simon Michael
bb5d473955
fix: lib: don't use $PAGER when TERM=dumb
2023-01-27 06:01:49 -10:00
Simon Michael
45808c8e13
imp: cli: add terminalLightness; tweak IsLight threshold; embolden banner
2023-01-26 22:11:20 -10:00
Simon Michael
1da4fd1eaf
imp: lib: terminal colour detection
...
added:
terminalIsLight
terminalFgColor
terminalBgColor
2023-01-26 22:11:20 -10:00
Simon Michael
d77d76e17f
imp: cli: use $PAGER when help output is taller than terminal
...
This works with hledger, hledger -h and hledger CMD -h.
2023-01-25 17:20:27 -10:00
Simon Michael
b079bbdb4e
dev: lib: Hledger.Utils cleanup
2022-11-04 22:19:24 -10:00
Simon Michael
79047ccc43
dev: lib: consolidate some utils in Hledger.Utils.IO
2022-11-04 19:14:36 -10:00
Simon Michael
fc8aa5253a
dev: lib: Hledger.Utils.Print -> Hledger.Utils.IO
2022-11-04 18:39:31 -10:00