From 98e3da2c4ce24c869b2ec51f129c157d11593456 Mon Sep 17 00:00:00 2001 From: Maulik Patel Date: Sun, 7 Feb 2021 22:11:40 -0800 Subject: [PATCH] [show ] Issue in CLI output alignment with shorter alias na Fix for https://github.com/Azure/sonic-utilities/issues/13 **- What I did** Added fix **- How I did it** Added code to remove last few extra characters from string **- How to verify it** Steps to reproduce: 1. Change the naming mode to alias instead of port names admin@sonic-svk169-dut:~$ config interface_naming_mode 2. Update config_db.json for port section to change alias t 3. Reload and run following command **- New command output With shorter alias names: admin@sonic-svk169-dut:~$ show interfaces counters IFACE STATE RX_OK RX_BPS RX_UTIL RX_ERR R ------- ------- ------- -------- --------- -------- - P0 X 0 N/A N/A 0 P4 X 0 N/A N/A 0 Signed-off-by: Maulik Patel --- utilities_common/cli.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/utilities_common/cli.py b/utilities_common/cli.py index 495bf7d5e6..d90f427b8b 100644 --- a/utilities_common/cli.py +++ b/utilities_common/cli.py @@ -351,6 +351,8 @@ def print_output_in_alias_mode(output, index): if output.startswith("---"): word = output.split() dword = word[index] + if(len(dword) > iface_alias_converter.alias_max_length): + dword = dword[:len(dword) - iface_alias_converter.alias_max_length] underline = dword.rjust(iface_alias_converter.alias_max_length, '-') word[index] = underline