Looks like the homebrew formula is one behind the latest, 3.0.0 vs 3.0.1 on your site - is the homebrew formula maintained by you or someone else?
trap 'caller 1' ERR
should do the same thing. Also you should set "errtrace" (-E) and possibly "nounset" (-u) and "pipefail". #!/bin/bash
SCRIPT="$1"; shift
uv sync --quiet --script "$SCRIPT" && exec uv run --python "$(uv python find --script "$SCRIPT")" nvim "$SCRIPT" "$@"
%(fmt)T -output the date-time string resulting from using FMT as a format string for strftime(3)
The man page provides a bit more detail: %(datefmt)T causes printf to output the date-time string resulting from using datefmt as a format string for strftime(3). The corresponding argument is an integer
representing the number of seconds since the epoch. Two special argument values may be used: -1 represents the current time, and -2 represents the time
the shell was invoked. If no argument is specified, conversion behaves as if -1 had been given. This is an exception to the usual printf behavior.
With that, timestamp=$(date +'%y.%m.%d %H:%M:%S')
becomes printf -v timestamp '%(%y.%m.%d %H:%M:%S)T' -1
#!/bin/bash
die() {
local frame=0
while caller $frame; do
((++frame));
done
echo "$*"
exit 1
}
f1() { die "*** an error occured ***"; }
f2() { f1; }
f3() { f2; }
f3
Output
12 f1 ./callertest.sh
13 f2 ./callertest.sh
14 f3 ./callertest.sh
16 main ./callertest.sh
*** an error occured ***
Via: https://bash-hackers.gabe565.com/commands/builtin/caller/https://news.ycombinator.com/item?id=31592934 (200 comments)
https://news.ycombinator.com/item?id=37782493 (105 comments)
Opus 4 beat all other models. It's good.