Skip to content

Commit

Permalink
cli/status: fix plain print with --diff
Browse files Browse the repository at this point in the history
The logic to remove tags from the output wasn't working for the
interface header in diff mode.
  • Loading branch information
daniloegea committed Jun 12, 2024
1 parent 8f8b74e commit 0f7d3d0
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions netplan_cli/cli/commands/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -751,10 +751,14 @@ def _display_missing_interfaces(self):
def plain_print(self, *args, **kwargs):
if len(args):
lst = list(args)
for tag in MATCH_TAGS.findall(lst[0]):
# remove matching opening and closing tag
lst[0] = lst[0].replace('[{}]'.format(tag), '')\
.replace('[/{}]'.format(tag), '')
while True:
tags = MATCH_TAGS.findall(lst[0])
if not tags:
break
for tag in tags:
# remove matching opening and closing tag
lst[0] = lst[0].replace('[{}]'.format(tag), '')\
.replace('[/{}]'.format(tag), '')
return print(*lst, **kwargs)
return print(*args, **kwargs)

Expand Down

0 comments on commit 0f7d3d0

Please sign in to comment.