From 928ffccf2e356ec27fefcc0fc3231abb473e28e7 Mon Sep 17 00:00:00 2001 From: Alexander Klimetschek Date: Wed, 5 Mar 2025 16:09:53 -0800 Subject: [PATCH] fix: color warning and error messages #26 --- src/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/index.js b/src/index.js index 9930293..2b00965 100755 --- a/src/index.js +++ b/src/index.js @@ -19,6 +19,14 @@ import version from './commands/version.js'; import { GLOBAL_OPTS } from './opts.js'; import yargsAhoy from './yargs-ahoy.js'; +// colorize console output +const wrapConsole = + (original, fn) => + (...args) => + original(fn(...args)); +console.warn = wrapConsole(console.warn, chalk.yellow); +console.error = wrapConsole(console.error, chalk.red); + const yargs = yargsAhoy(); await yargs .command(service)