| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Since its introduction, we had multiple issues with the colorize awk
script with regard to non-GNU awk compatibility.
Also, this script is standalone and the color theme must be hard coded
into it. Reading from an external configuration file (aerc's styleset)
from a non-GNU awk is close to impossible (and even far from trivial
with GNU awk).
Rewrite the builtin colorize filter in C to allow getting the color
theme from aerc's active styleset. The theme is configured using the
existing styleset syntax and attributes under a separate [viewer]
section (see examples and man page).
Export the active styleset file path to AERC_STYLESET env var when
invoking the filter command so that colorize can access it and use it.
I have tested compilation (with clang-analyzer and gcc -fanalyzer) and
basic operation on FreeBSD, Fedora (glibc) and Alpine (muslibc). More
tests would probably be required on MacOSX and older Linux distros.
I also added test vectors to give some confidence that this works as
expected. The execution with these vectors passed valgrind
--leak-check=full without errors.
NB: the default theme has changed to be more minimal. Sample stylesets
have more colorful examples. The awk -v theme=xxx option is no longer
supported.
usage: colorize [-h] [-s FILE] [-f FILE]
options:
-h show this help message
-s FILE use styleset file (default $AERC_STYLESET)
-f FILE read from filename (default stdin)
Signed-off-by: Robin Jarry <robin@jarry.cc>
Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
Acked-by: Moritz Poldrack <moritz@poldrack.dev>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If log.PanicHandler() is not installed in a goroutine and a panic
occurs, the terminal state is not restored. This causes the panic trace
to be unreadable since the terminal is broken.
Add a custom analyzer that parses our code and ensures that:
defer log.PanicHandler()
is the first statement of all functions that are executed in goroutines.
Include that linter in golangci config.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I had started writing this as an awk script but quickly got stuck with
obscure code which did not even work properly. I jumped the gun and re
did it in go. Bonus, we will not have MacOS's 1987 BSD awk issues. On
the other hand, instead of a 20.0K awk script, we now have a 2.2M static
go binary. If this makes people scream, I challenge them to do that with
BSD awk :)
Basically, this takes text from stdin or from a file and wraps long
lines on word boundaries. It takes care of not breaking up email quotes
nor list items (numbered as well). Also, it is conservative by default
and only wraps long lines and lines that end with a space (indicating
a format=flowed message).
If the AERC_SUBJECT environment variable is defined and contains the
word PATCH, the text is not modified at all (i.e. wrap behaves as
cat(1)).
There are a few command line options to control behavior:
Usage of ./wrap:
-f string
read from file instead of stdin
-l int
minimum percentage of letters in a line to be considered
a paragaph (default 50)
-r reflow all paragraphs even if no trailing space
-w int
preferred wrap margin (default 80)
Update docs, makefile and default config file with examples.
Add a torture test to ensure it works as expected.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
|
|
|
|
|
|
|
|
|
|
| |
Use the same name than the builtin "log" package. That way, we do not
risk logging in the wrong place.
Suggested-by: Tim Culverhouse <tim@timculverhouse.com>
Signed-off-by: Robin Jarry <robin@jarry.cc>
Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
Acked-by: Tim Culverhouse <tim@timculverhouse.com>
|
|
|
|
|
|
|
| |
Running `make dev` creates race.log.* files. Ignore these by default.
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Running make with different values for GOFLAGS or VERSION does not cause
aerc to be rebuilt whereas it should.
Write the go build command line into a file and force aerc to be rebuilt
if the command line has changed.
Use the BSD make compatible != operator to run the command. This
operator is also available in GNU make since version 4.0.
Link: https://git.savannah.gnu.org/cgit/make.git/commit/?id=b34438bee83ee
Signed-off-by: Robin Jarry <robin@jarry.cc>
Tested-by: Koni Marti <koni.marti@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Instead of using a static SHAREDIR at compile time, use a list of
standard paths to use at runtime for templates, config files and
stylesets.
This implies removing all default filters in the default configuration.
Replace them with basic commands. New users can configure the filters as
they wish.
Signed-off-by: Robin Jarry <robin@jarry.cc>
|
|
|
|
|
|
|
|
| |
Do not use this to run the debugger. Instead, build a non-optimized
binary and display what command should be executed to attach to
a running program.
Signed-off-by: Robin Jarry <robin@jarry.cc>
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|