How can I highlight the warning and error lines in the make output?

前端 未结 7 2097
醉话见心
醉话见心 2021-01-30 11:19

Sometimes, make\'s output fills the screen. It\'s a little bit hard to identify all the warning and error message lines. I know may shell color output can help Can anyone can he

7条回答
  •  遥遥无期
    2021-01-30 11:50

    Have a look at colormake, found here

    $ apt-cache search colormake
    colormake - simple wrapper around make to colorize output
    

    Using the power of google, I also found this bash-function.

    make()
    {
      pathpat="(/[^/]*)+:[0-9]+"
      ccred=$(echo -e "\033[0;31m")
      ccyellow=$(echo -e "\033[0;33m")
      ccend=$(echo -e "\033[0m")
      /usr/bin/make "$@" 2>&1 | sed -E -e "/[Ee]rror[: ]/ s%$pathpat%$ccred&$ccend%g" -e "/[Ww]arning[: ]/ s%$pathpat%$ccyellow&$ccend%g"
      return ${PIPESTATUS[0]}
    }
    

提交回复
热议问题