Summary: | sys-apps/portage: add variable like PORTAGE_LOG_FILTER_FILE_CMD that's used to filter stdout if it's not a tty | ||
---|---|---|---|
Product: | Portage Development | Reporter: | Zac Medico <zmedico> |
Component: | Core - Configuration | Assignee: | Portage team <dev-portage> |
Status: | CONFIRMED --- | ||
Severity: | enhancement | CC: | gentoo, sam |
Priority: | Normal | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | All | ||
See Also: | https://bugs.gentoo.org/show_bug.cgi?id=814656 | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- |
Description
Zac Medico
2021-04-15 01:32:03 UTC
Ideally I think the default behaviour should be to strip ansi escape sequences when stdout out is not a tty - I've seen this as the default in other programs (i.e. hledger, git diff) and it tends to work well for typical workflows. As it is, we have tty detection linked to the NOCOLOR environment variable, via this code:
> bin/isolated-functions.sh:case "${NOCOLOR:-false}" in
> bin/isolated-functions.sh- yes|true)
> bin/isolated-functions.sh- __unset_colors
> bin/isolated-functions.sh- ;;
> lib/_emerge/actions.py- elif settings.get('TERM') == 'dumb' or \
> lib/_emerge/actions.py: not sys.stdout.isatty():
> lib/_emerge/actions.py- portage.output.havecolor = 0
> lib/_emerge/actions.py- settings["NOCOLOR"] = "true"
> lib/_emerge/actions.py- settings.backup_changes("NOCOLOR")
> eclass/cargo.eclass: $([[ "${NOCOLOR}" = true || "${NOCOLOR}" = yes ]] && echo "color = 'never'")
> eclass/cargo.eclass: [[ "${NOCOLOR}" = true || "${NOCOLOR}" = yes ]] && export CARGO_TERM_COLOR=never
> eclass/cmake-utils.eclass: [[ "${NOCOLOR}" = true || "${NOCOLOR}" = yes ]] && echo 'SET (CMAKE_COLOR_MAKEFILE OFF CACHE BOOL "pretty colors during make" FORCE)' >> "${common_config}"
> eclass/cmake.eclass: if [[ "${NOCOLOR}" = true || "${NOCOLOR}" = yes ]]; then
> eclass/ruby-ng.eclass:# which also respects TEST_VERBOSE and NOCOLOR environment variables.
> eclass/ruby-ng.eclass: case ${NOCOLOR} in
> eclass/ruby-ng.eclass:# which also respects TEST_VERBOSE and NOCOLOR environment variables.
> eclass/ruby-ng.eclass: case ${NOCOLOR} in
> eclass/ruby-ng.eclass:# This also respects TEST_VERBOSE and NOCOLOR environment variables.
> eclass/ruby-ng.eclass: case ${NOCOLOR} in
(Worth noting that NO_COLOR with the underscore seems to be a new standard being converged on: https://no-color.org) |