Make parser error messages prettier and fatal
The aoix command will now exit non-zero if there is a parse error which should mean make
and CI/CD notice failure quicker. Other exit code behaviour is unchanged.
Make use of the rich
library to colourize error output so that it is easier to spot in CI/CD logs.
While here, also remove some file opening and writing code in favour of outsourcing file opening to argparse
and argparse.FileType
.
Change in behaviour: previously if output was to stdout, then it would have a trailing newline added but file output (-o
) would not. Now both are written to with a single trailing newline, irrespective of the input.