netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH iproute2-next] Enable automatic color output by default.
@ 2023-09-11  4:45 Sam Foxman
  2023-09-11 10:20 ` Petr Machata
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Sam Foxman @ 2023-09-11  4:45 UTC (permalink / raw)
  To: netdev; +Cc: Sam Foxman

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.
---
 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.
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH iproute2-next] Enable automatic color output by default.
  2023-09-11  4:45 [PATCH iproute2-next] Enable automatic color output by default Sam Foxman
@ 2023-09-11 10:20 ` Petr Machata
  2023-09-11 10:35 ` Petr Machata
  2023-09-11 16:19 ` Stephen Hemminger
  2 siblings, 0 replies; 4+ messages in thread
From: Petr Machata @ 2023-09-11 10:20 UTC (permalink / raw)
  To: Sam Foxman; +Cc: netdev


Sam Foxman <elasticvine@protonmail.com> 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.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH iproute2-next] Enable automatic color output by default.
  2023-09-11  4:45 [PATCH iproute2-next] Enable automatic color output by default Sam Foxman
  2023-09-11 10:20 ` Petr Machata
@ 2023-09-11 10:35 ` Petr Machata
  2023-09-11 16:19 ` Stephen Hemminger
  2 siblings, 0 replies; 4+ messages in thread
From: Petr Machata @ 2023-09-11 10:35 UTC (permalink / raw)
  To: Sam Foxman; +Cc: netdev


Sam Foxman <elasticvine@protonmail.com> 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.

And BTW for v2, if any, please ditch the terminating period on the
subject line.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH iproute2-next] Enable automatic color output by default.
  2023-09-11  4:45 [PATCH iproute2-next] Enable automatic color output by default Sam Foxman
  2023-09-11 10:20 ` Petr Machata
  2023-09-11 10:35 ` Petr Machata
@ 2023-09-11 16:19 ` Stephen Hemminger
  2 siblings, 0 replies; 4+ messages in thread
From: Stephen Hemminger @ 2023-09-11 16:19 UTC (permalink / raw)
  To: Sam Foxman; +Cc: netdev

On Mon, 11 Sep 2023 04:45:23 +0000
Sam Foxman <elasticvine@protonmail.com> wrote:

> From: Sam Foxman <elasticvine@protonmail.com>
> To: netdev@vger.kernel.org
> Cc: Sam Foxman <elasticvine@protonmail.com>
> Subject: [PATCH iproute2-next] Enable automatic color output by
> default. Date: Mon, 11 Sep 2023 04:45:23 +0000
> 
> 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.
> ---
>  ip/ip.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Changing the default is likely to make existing users upset.
If there was a generic way to ask for color (ie across ls, ethtool, etc)
then iproute2 could follow that.

For now if you want automatic color just use aliases like almost every
Linux distro does now for ls.

This change gets a no from me.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-09-11 16:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-11  4:45 [PATCH iproute2-next] Enable automatic color output by default Sam Foxman
2023-09-11 10:20 ` Petr Machata
2023-09-11 10:35 ` Petr Machata
2023-09-11 16:19 ` Stephen Hemminger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).