Because just like the code page in locales, you should not need to care about terminfo if all you want to do is show some basic color. In $current_year it is OK to assume that the current terminal (if stdout/stderr is a TTY) can at least parse color escape sequences - if yours doesn't then create your own wrapper that strips them. Generally the way git does it should be considered best practice. If
- Output is a TTY
- The NO_COLOR environment variable is not defined
- The TERM environment variable is not set to "dumb"
The git approach here is not "not caring about terminfo", but delegating the caring (of the difficult parts at least) to another program, namely the pager. The default pager `less` depends on the information in TERM and the terminfo database, and it has to, since functions like toggling to the alternate screen buffer are not standardized per ansi.
I agree that you will need something like terminfo if you writing a TUI like a pager, but for most CLI programs you only need simple color output and maybe cursor movement on and erasing of the current line and for that terminfo is an unnecessary dependency.
- Output is a TTY
- The NO_COLOR environment variable is not defined
- The TERM environment variable is not set to "dumb"
then enable colors by default.