summaryrefslogtreecommitdiff
path: root/src/op_mode/show_interfaces.py
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-06-20 22:33:11 +0200
committerChristian Poessinger <christian@poessinger.com>2020-06-20 22:33:11 +0200
commit5d6f3db6a0a6e65a9eb81cede4c59c7d22f2cae0 (patch)
treed09796e37e2671f59746e04a0a63e7fabe13ede2 /src/op_mode/show_interfaces.py
parent7e258d0f77c005baf27a50160aa8b82b8562975c (diff)
downloadvyos-1x-5d6f3db6a0a6e65a9eb81cede4c59c7d22f2cae0.tar.gz
vyos-1x-5d6f3db6a0a6e65a9eb81cede4c59c7d22f2cae0.zip
op-mode: T2621: fix repeated interface description
Diffstat (limited to 'src/op_mode/show_interfaces.py')
-rwxr-xr-xsrc/op_mode/show_interfaces.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/op_mode/show_interfaces.py b/src/op_mode/show_interfaces.py
index ebb3508f0..46571c0c0 100755
--- a/src/op_mode/show_interfaces.py
+++ b/src/op_mode/show_interfaces.py
@@ -96,10 +96,14 @@ def split_text(text, used=0):
line = ''
for word in text.split():
- if len(line) + len(word) >= desc_len:
- yield f'{line} {word}'[1:]
- line = ''
- line = f'{line} {word}'
+ if len(line) + len(word) < desc_len:
+ line = f'{line} {word}'
+ continue
+ if line:
+ yield line[1:]
+ else:
+ line = f'{line} {word}'
+
yield line[1:]