v2:
- Replace the 2 newly introduced fprintf() func calls with print_string()
to address Stephen's suggestion.
For the bridge cmd, the "colorize output" cmd line option's usage and the
corresponding output does not seem to be consistent with the usage and the
output of the "ip" cmds.
Example 1: As per the "colorize output" cmd line option documented in the
man pages man/man8/ip.8 & man/man8/bridge.8, using "-c" with "ip" or the
"bridge" should colorize the output. But this is working only with the "ip"
cmd and for the "bridge" cmd, the option "-col" / "-colo" / "-color" needs
to be used instead of just "-c".
Example 2: After fixing the inconsistency mentioned in Example 1,
- Running the cmd "$ ip -c neigh", will give the following output where the
"172.16.12.250", "bridge0" & "04:d9:f5:c1:0c:74" fields are highlighted
and not the fixed keywords "dev" & "lladdr".
172.16.12.250 dev bridge0 lladdr 04:d9:f5:c1:0c:74 REACHABLE
- But running the cmd "$ bridge -c fdb", will give the following output
where "00:00:00:00:00:00", "dev", "vxlan100", "dst" & "2001:db8:2::1" are
highlighted, even though "dev" & "dst" keywords are static.
00:00:00:00:00:00 dev vxlan100 dst 2001:db8:2::1 self permanent
Also fix a typo in man/man8/bridge.8 to change "-c[lor]" into "-c[olor]".
Gokul Sivakumar (3):
bridge: reorder cmd line arg parsing to let "-c" detected as "color"
option
bridge: fdb: don't colorize the "dev" & "dst" keywords in "bridge -c
fdb"
man: bridge: fix the typo to change "-c[lor]" into "-c[olor]" in man
page
bridge/bridge.c | 2 +-
bridge/fdb.c | 13 ++++++++++---
man/man8/bridge.8 | 2 +-
3 files changed, 12 insertions(+), 5 deletions(-)
--
2.25.1
As per the man/man8/bridge.8 page, the shorthand cmd line arg "-c" can be
used to colorize the bridge cmd output. But while parsing the args in while
loop, matches() detects "-c" as "-compressedvlans" instead of "-color", so
fix this by doing the check for "-color" option first before checking for
"-compressedvlans".
Signed-off-by: Gokul Sivakumar <redacted>
---
bridge/bridge.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
To be consistent with the colorized output of "ip" command and to increase
readability, stop highlighting the "dev" & "dst" keywords in the colorized
output of "bridge -c fdb" cmd.
Example: in the following "bridge -c fdb" entry, only "00:00:00:00:00:00",
"vxlan100" and "2001:db8:2::1" fields should be highlighted in color.
00:00:00:00:00:00 dev vxlan100 dst 2001:db8:2::1 self permanent
Signed-off-by: Gokul Sivakumar <redacted>
---
bridge/fdb.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
From: David Ahern <hidden> Date: 2021-08-17 15:11:19
On 8/14/21 12:47 PM, Gokul Sivakumar wrote:
quoted hunk
As per the man/man8/bridge.8 page, the shorthand cmd line arg "-c" can be
used to colorize the bridge cmd output. But while parsing the args in while
loop, matches() detects "-c" as "-compressedvlans" instead of "-color", so
fix this by doing the check for "-color" option first before checking for
"-compressedvlans".
Signed-off-by: Gokul Sivakumar <redacted>
---
bridge/bridge.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
On Tue, 2021-08-17 at 09:11 -0600, David Ahern wrote:
On 8/14/21 12:47 PM, Gokul Sivakumar wrote:
quoted
As per the man/man8/bridge.8 page, the shorthand cmd line arg "-c" can be
used to colorize the bridge cmd output. But while parsing the args in while
loop, matches() detects "-c" as "-compressedvlans" instead of "-color", so
fix this by doing the check for "-color" option first before checking for
"-compressedvlans".
Signed-off-by: Gokul Sivakumar <redacted>
---
bridge/bridge.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Another example of why matches needs to be deprecated.
Re-assigned the set to Stephen for main tree.
Thanks, i will send a v3 patchset with the subject prefix "PATCH iproute2"
instead of "PATCH iproute2-next" after addressing Stephen's recent suggestion
to remove the unnecessary is_json_context() condition checks from patch 2/3.
Gokul