Subject: Re: [PATCH iproute2-next] Enable automatic color output by default.

From: Petr Machata <[email-masked]>
Date: Mon, 11 Sep 2023 12:20:02 +0200

Sam Foxman <[email-masked]> writes:

> Automatic color should be enabled by default because it makes command
> output much easier to read, especially `ip addr` with many interfaces.
> Color is enabled only in interactive use, scripts are not affected.

tc and bridge should do the same.

FWIW, `ls' on Fedora is aliased to `ls --color=auto' by default. My
guess is that the reason that it's not auto by default was the
performance hit resulting from having to stat every file.

iproute2 tools do not have that issue -- overhead from those escape
sequences must surely be noise? So it would IMHO make sense to default
to color output for iproute2 tools.

> ---
>  ip/ip.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/ip/ip.c b/ip/ip.c
> index 8c046ef1..aad6b6d7 100644
> --- a/ip/ip.c
> +++ b/ip/ip.c
> @@ -168,7 +168,7 @@ int main(int argc, char **argv)
>  	const char *libbpf_version;
>  	char *batch_file = NULL;
>  	char *basename;
> -	int color = 0;
> +	int color = COLOR_OPT_AUTO;
>  
>  	/* to run vrf exec without root, capabilities might be set, drop them
>  	 * if not needed as the first thing.