diff --git a/Justfile b/Justfile index 34d07a8b5..e3c83f223 100644 --- a/Justfile +++ b/Justfile @@ -491,7 +491,7 @@ STACKTEST := STACK + ' test --fast' @unittest: ($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 diff --git a/doc/DEVWORKFLOWS.md b/doc/DEVWORKFLOWS.md index 2c9817f76..4e7b423dd 100644 --- a/doc/DEVWORKFLOWS.md +++ b/doc/DEVWORKFLOWS.md @@ -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. -## 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: - 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 \ No newline at end of file diff --git a/hledger-ui/hledger-ui.m4.md b/hledger-ui/hledger-ui.m4.md index 13dd0060d..4fd4498a7 100644 --- a/hledger-ui/hledger-ui.m4.md +++ b/hledger-ui/hledger-ui.m4.md @@ -347,10 +347,6 @@ clocks on both machines should be roughly in agreement. # ENVIRONMENT -**COLUMNS** -The screen width to use. -Default: the full terminal width. - **LEDGER_FILE** The main journal file to use when not specified with `-f/--file`. Default: `$HOME/.hledger.journal`. diff --git a/hledger/Hledger/Cli/Commands/Register.md b/hledger/Hledger/Cli/Commands/Register.md index 0d6b6aa52..04e629f15 100644 --- a/hledger/Hledger/Cli/Commands/Register.md +++ b/hledger/Hledger/Cli/Commands/Register.md @@ -148,9 +148,8 @@ no posting will be shown and the program exit code will be non-zero. ### Custom register output -register uses the full terminal width by default, except on windows. -You can override this by setting the `COLUMNS` environment variable (not a bash shell variable) -or by using the `--width`/`-w` option. +register normally uses the full terminal width (or 80 columns if it can't detect that). +You can override this with the `--width`/`-w` option. The description and account columns normally share the space equally (about half of (width - 40) each). You can adjust this by adding a @@ -165,10 +164,7 @@ and some examples: ```cli $ hledger reg # use terminal width (or 80 on windows) $ 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 $COLUMNS,40 # use terminal width, & description width 40 ``` This command also supports the diff --git a/hledger/hledger.m4.md b/hledger/hledger.m4.md index 6b435ba2a..8cd97483f 100644 --- a/hledger/hledger.m4.md +++ b/hledger/hledger.m4.md @@ -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. (This can be challenging on MS Windows.) -Some reports (`register`, `aregister`) will use the width indicated by the `COLUMNS` environment variable. -If your shell and terminal are working well, they will keep COLUMNS updated as you resize the window. -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. +Some reports (`register`, `aregister`) will normally use the full window width. +If this isn't working or you want to override it, you can use the `-w`/`--width` option. 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, @@ -986,11 +984,6 @@ hledger bal --debug=3 2>hledger.log 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** If `less` is your [pager](#paging), this variable specifies the `less` options hledger should use. (Otherwise, `LESS` + custom options are used.) diff --git a/hledger/test/README.md b/hledger/test/README.md index 0f0cf1b01..7111c8d0a 100644 --- a/hledger/test/README.md +++ b/hledger/test/README.md @@ -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): - make functest + just functest -See how the Makefile is invoking shelltestrunner: +See the commands being run: - $ make functest -n - stack build --fast hledger - (COLUMNS=80 stack exec -- shelltest --execdir -j16 --hide-successes --exclude=/_ -w `stack exec -- which hledger` tests \ - && echo functest PASSED) || (echo functest FAILED; false) + $ just -v functest + ===> Running recipe `functest`... + $STACK build --ghc-options=-Werror hledger + 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. -- `--execdir` runs each test within its own directory. -- ``-w `stack exec -- which hledger` `` ensures you are testing the hledger executable that was just built. -- `-j16` runs tests in parallel which is much faster. +- `stack exec -- ...` ensures you are testing the hledger executable that was just built (it will be first in PATH). +- `--execdir` executes tests within their test file's directory. +- `--exclude=/_` excludes top-level test files whose names begin with underscore. +- `--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] Test Cases Total @@ -64,21 +65,9 @@ Run only the tests matching a regular expression (`balance-assertions:.*19` in t Failed 0 0 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 - :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" + $ watchexec -w hledger/test/journal/balance-assertions.test just functest -i balance-assertions.*19 :hledger/test/cli/query-args.test:1: [OK] Test Cases Total