On Mon, Mar 02, 2026 at 09:24:28PM -0500, Joe Lawrence wrote: > On Mon, Feb 23, 2026 at 01:32:09PM -0800, Josh Poimboeuf wrote: > > On Mon, Feb 23, 2026 at 01:28:45PM -0800, Josh Poimboeuf wrote: > > > On Tue, Feb 17, 2026 at 11:06:42AM -0500, Joe Lawrence wrote: > > > > Improve the readability of klp-build output by implementing a basic > > > > color scheme. When the standard output and error are connected to a > > > > terminal, highlight status messages in bold, warnings in yellow, and > > > > errors in red. > > > > > > > > Signed-off-by: Joe Lawrence <[email protected]> > > > > --- > > > > scripts/livepatch/klp-build | 15 ++++++++++++--- > > > > 1 file changed, 12 insertions(+), 3 deletions(-) > > > > > > > > diff --git a/scripts/livepatch/klp-build b/scripts/livepatch/klp-build > > > > index 80703ec4d775..fd104ace29e6 100755 > > > > --- a/scripts/livepatch/klp-build > > > > +++ b/scripts/livepatch/klp-build > > > > @@ -52,6 +52,15 @@ PATCH_TMP_DIR="$TMP_DIR/tmp" > > > > > > > > KLP_DIFF_LOG="$DIFF_DIR/diff.log" > > > > > > > > +# Terminal output colors > > > > +read -r COLOR_RESET COLOR_BOLD COLOR_ERROR COLOR_WARN <<< "" > > > > +if [[ -t 1 && -t 2 ]]; then > > > > + COLOR_RESET="\033[0m" > > > > + COLOR_BOLD="\033[1m" > > > > + COLOR_ERROR="\033[0;31m" > > > > + COLOR_WARN="\033[0;33m" > > > > +fi > > > > + > > > > grep0() { > > > > # shellcheck disable=SC2317 > > > > command grep "$@" || true > > > > @@ -65,15 +74,15 @@ grep() { > > > > } > > > > > > > > status() { > > > > - echo "$*" > > > > + echo -e "${COLOR_BOLD}$*${COLOR_RESET}" > > > > } > > > > > > > > warn() { > > > > - echo "error: $SCRIPT: $*" >&2 > > > > + echo -e "${COLOR_WARN}warn${COLOR_RESET}: $SCRIPT: $*" >&2 > > > > > > Shouldn't this reset the colors *after* printing out the whole message? > > > > > Colorizing the "warn:" and "error:" was intended to look similar to gcc > color output. I can easily highlight the entire message if you prefer.
I guess I was confused because a) the commit log made it sound like the entire warning is in color and b) the status messages are also for the entire message. I don't know if I have a preference either way, but at least the commit log should make the intended behavior more clear. -- Josh
