From 327b29287675925b6816be9fc41f5f58cd6b7b84 Mon Sep 17 00:00:00 2001 From: maulik_patel_innovium Date: Tue, 16 Feb 2021 22:58:10 +0530 Subject: [PATCH] [show] Issue in CLI output alignment with shorter alias names in intf naming mode "alias" #1397 (#1411) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #### What I did Added fix for Issue in CLI output alignment with shorter alias names in intf naming mode "alias" #### How I did it Added code to remove last few extra characters from string (-------…) using Slicing & Positive Indexing in python, to match the width to alias's name(not interface) --- utilities_common/cli.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/utilities_common/cli.py b/utilities_common/cli.py index 4046d097d37f..ed103649e4c5 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