M_attr(3f) - add a splash of color to Fortran terminal output

M_attr(3f) is a module for adding basic color to output when appropriate, and is available at

        git clone https://github.com/urbanjost/M_attr.git

which can be built with fpm or GNU make(1)
or just be used as a dependency in your fpm manifest file (“fpm.toml”).

     [dependencies]
        M_attr = { git = "https://github.com/urbanjost/M_attr.git" }

It is an expansion on the HTML-like text input mode (out
of several) discussed in the experimental module M_escape(3f). It
includes allowing for arrays of text that can be displayed in a block,
formal testing, and a command line example program (“tat”) that
shows how it can easily be used with external files for purposes such
as message catalogs (tat(1) cannot be built simply with make(1), but requires fpm(1)).

Another complete mini- program (“redirect”) shows how to detect if displaying
on a terminal with ifort(1) and gfortran(1) without requiring a C
interface (See M_escape(3f) for examples of how to use C to setup
for color on MSWindows when not available).

Hopefully, a splash of color may brighten your day.

I am trying to gauge interest in whether this is suitable for proposing as part of stdlib, so feedback is particularly valued.

7 Likes

I think this is certainly the kind of thing that could be useful on a regular basis. I’ll see if I can find some time to look at it.

I would be interested if the terminal detection logic could be spun off into its own project. The primary use case would be something like “A thing happened, are we running interactively? If so, ask the user what they would like to do, if not just do this.” Having that kind of thing just work and be completely portable would be very valuable I think, and it sounds like you may have solved (at least part of) it in pursuit of this project.