;doc: manuals: remove obsolete mentions of COLUMNS [#2340]

This commit is contained in:
Simon Michael 2025-02-27 14:54:59 -10:00
parent d346e56b79
commit b629c31f9a
6 changed files with 22 additions and 52 deletions

View File

@ -491,7 +491,7 @@ STACKTEST := STACK + ' test --fast'
@unittest: @unittest:
($STACK exec hledger test && echo $@ PASSED) || (echo $@ FAILED; false) ($STACK exec hledger test && echo $@ PASSED) || (echo $@ FAILED; false)
SHELLTEST := 'COLUMNS=80 ' + STACK + ' exec -- shelltest --execdir --exclude=/_ --threads=32' SHELLTEST := STACK + ' exec -- shelltest --execdir --exclude=/_ --threads=32'
# --hide-successes # --hide-successes

View File

@ -224,10 +224,6 @@ stack's --file-watch flag will re-run build/test/bench when source files or pack
If you find that adding --fast makes this any faster, please update this. If you find that adding --fast makes this any faster, please update this.
## Use entr for watching arbitrary commands
[entr](https://entrproject.org/) is the most robust cross-platform tool for watching files and running a command when they change. Note its first argument must be an executable program, to run a shell command or multiple commands use `bash -c "..."`.
### Rerun a single functional test as you change it: ### Rerun a single functional test as you change it:
ls hledger/test/budget/budget.test | entr bash -c 'clear; COLUMNS=80 stack exec -- shelltest --execdir hledger/test/budget/budget.test -i12' watchexec -w hledger/test/journal/balance-assertions.test just functest -i budget.*19

View File

@ -347,10 +347,6 @@ clocks on both machines should be roughly in agreement.
# ENVIRONMENT # ENVIRONMENT
**COLUMNS**
The screen width to use.
Default: the full terminal width.
**LEDGER_FILE** **LEDGER_FILE**
The main journal file to use when not specified with `-f/--file`. The main journal file to use when not specified with `-f/--file`.
Default: `$HOME/.hledger.journal`. Default: `$HOME/.hledger.journal`.

View File

@ -148,9 +148,8 @@ no posting will be shown and the program exit code will be non-zero.
### Custom register output ### Custom register output
register uses the full terminal width by default, except on windows. register normally uses the full terminal width (or 80 columns if it can't detect that).
You can override this by setting the `COLUMNS` environment variable (not a bash shell variable) You can override this with the `--width`/`-w` option.
or by using the `--width`/`-w` option.
The description and account columns normally share the space equally The description and account columns normally share the space equally
(about half of (width - 40) each). You can adjust this by adding a (about half of (width - 40) each). You can adjust this by adding a
@ -165,10 +164,7 @@ and some examples:
```cli ```cli
$ hledger reg # use terminal width (or 80 on windows) $ hledger reg # use terminal width (or 80 on windows)
$ hledger reg -w 100 # use width 100 $ hledger reg -w 100 # use width 100
$ COLUMNS=100 hledger reg # set with one-time environment variable
$ export COLUMNS=100; hledger reg # set till session end (or window resize)
$ hledger reg -w 100,40 # set overall width 100, description width 40 $ hledger reg -w 100,40 # set overall width 100, description width 40
$ hledger reg -w $COLUMNS,40 # use terminal width, & description width 40
``` ```
This command also supports the This command also supports the

View File

@ -732,10 +732,8 @@ This is the default: human readable, plain text report output, suitable for view
If your data contains unicode or wide characters, you'll need a terminal and font that render those correctly. If your data contains unicode or wide characters, you'll need a terminal and font that render those correctly.
(This can be challenging on MS Windows.) (This can be challenging on MS Windows.)
Some reports (`register`, `aregister`) will use the width indicated by the `COLUMNS` environment variable. Some reports (`register`, `aregister`) will normally use the full window width.
If your shell and terminal are working well, they will keep COLUMNS updated as you resize the window. If this isn't working or you want to override it, you can use the `-w`/`--width` option.
So register reports normally will use the full window width.
When this isn't working or you want to override it, you can manually set COLUMNS, or use the `-w`/`--width` option.
Balance reports (`balance`, `balancesheet`, `incomestatement`...) use whatever width they need. Balance reports (`balance`, `balancesheet`, `incomestatement`...) use whatever width they need.
Multi-period multi-currency reports can often be wider than the window. Besides using a pager, Multi-period multi-currency reports can often be wider than the window. Besides using a pager,
@ -986,11 +984,6 @@ hledger bal --debug=3 2>hledger.log
These environment variables affect hledger: These environment variables affect hledger:
**COLUMNS**
This is normally set by your terminal;
some hledger commands (`register`) will format their output to this width.
If not set, they will try to use the available terminal width.
**HLEDGER_LESS** **HLEDGER_LESS**
If `less` is your [pager](#paging), this variable specifies the `less` options hledger should use. If `less` is your [pager](#paging), this variable specifies the `less` options hledger should use.
(Otherwise, `LESS` + custom options are used.) (Otherwise, `LESS` + custom options are used.)

View File

@ -38,25 +38,26 @@ around ghc 9.10's extra newline in error output: https://gitlab.haskell.org/ghc/
Run them all (also builds hledger): Run them all (also builds hledger):
make functest just functest
See how the Makefile is invoking shelltestrunner: See the commands being run:
$ make functest -n $ just -v functest
stack build --fast hledger ===> Running recipe `functest`...
(COLUMNS=80 stack exec -- shelltest --execdir -j16 --hide-successes --exclude=/_ -w `stack exec -- which hledger` tests \ $STACK build --ghc-options=-Werror hledger
&& echo functest PASSED) || (echo functest FAILED; false) time ((stack exec -- shelltest --execdir --exclude=/_ --threads=32 hledger/test/ bin/ -x ledger-compat/ledger-baseline -x ledger-compat/ledger-regress -x ledger-compat/ledger-extra && echo $@ PASSED) || (echo $@ FAILED; false))
These are the most important: Some explanation:
- `COLUMNS=80` makes output independent of your terminal width. - `stack exec -- ...` ensures you are testing the hledger executable that was just built (it will be first in PATH).
- `--execdir` runs each test within its own directory. - `--execdir` executes tests within their test file's directory.
- ``-w `stack exec -- which hledger` `` ensures you are testing the hledger executable that was just built. - `--exclude=/_` excludes top-level test files whose names begin with underscore.
- `-j16` runs tests in parallel which is much faster. - `--threads=N` runs tests in parallel which is much faster.
- `-x` is another spelling of --exclude
Run only the tests matching a regular expression (`balance-assertions:.*19` in this case):) Run only the tests matching a regular expression (here, the 19th test in the balance-assertions.test file):
$ make functest-balance-assertions.*19 $ just functest -i balance-assertions.*19
:hledger/test/journal/balance-assertions.test:19: [OK] :hledger/test/journal/balance-assertions.test:19: [OK]
Test Cases Total Test Cases Total
@ -64,21 +65,9 @@ Run only the tests matching a regular expression (`balance-assertions:.*19` in t
Failed 0 0 Failed 0 0
Total 1 1 Total 1 1
Run only the tests in one file: Run a specific test repeatedly as its file is changed:
$ COLUMNS=80 shelltest --execdir -w `stack exec -- which hledger` hledger/test/cli/query-args.test $ watchexec -w hledger/test/journal/balance-assertions.test just functest -i balance-assertions.*19
:hledger/test/cli/query-args.test:1: [OK]
:hledger/test/cli/query-args.test:2: [OK]
:hledger/test/cli/query-args.test:3: [OK]
Test Cases Total
Passed 3 3
Failed 0 0
Total 3 3
Run a test [repeatedly](http://eradman.com/entrproject/) as its file is changed:
$ ls hledger/test/cli/query-args.test | entr bash -c "COLUMNS=80 shelltest --execdir -w `stack exec -- which hledger` hledger/test/cli/query-args.test -i1"
:hledger/test/cli/query-args.test:1: [OK] :hledger/test/cli/query-args.test:1: [OK]
Test Cases Total Test Cases Total