Don't show tag line in info if no tags

This commit is contained in:
Joshua Boniface 2021-07-14 00:59:24 -04:00
parent 75fb60b1b4
commit 6d4c26c8d8
1 changed files with 26 additions and 18 deletions

View File

@ -1382,27 +1382,35 @@ def format_info(config, domain_information, long_output):
if _tags_protected_length > tags_protected_length: if _tags_protected_length > tags_protected_length:
tags_protected_length = _tags_protected_length tags_protected_length = _tags_protected_length
ainformation.append('') if len(domain_information['tags']) > 0:
ainformation.append('{purple}Tags:{end} {bold}{tags_name: <{tags_name_length}} {tags_type: <{tags_type_length}} {tags_protected: <{tags_protected_length}}{end}'.format( ainformation.append('')
purple=ansiprint.purple(), ainformation.append('{purple}Tags:{end} {bold}{tags_name: <{tags_name_length}} {tags_type: <{tags_type_length}} {tags_protected: <{tags_protected_length}}{end}'.format(
bold=ansiprint.bold(), purple=ansiprint.purple(),
end=ansiprint.end(), bold=ansiprint.bold(),
tags_name_length=tags_name_length, end=ansiprint.end(),
tags_type_length=tags_type_length,
tags_protected_length=tags_protected_length,
tags_name='Name',
tags_type='Type',
tags_protected='Protected'
))
for tag in sorted(domain_information['tags'], key=lambda t: t['type'] + t['name']):
ainformation.append(' {tags_name: <{tags_name_length}} {tags_type: <{tags_type_length}} {tags_protected: <{tags_protected_length}}'.format(
tags_name_length=tags_name_length, tags_name_length=tags_name_length,
tags_type_length=tags_type_length, tags_type_length=tags_type_length,
tags_protected_length=tags_protected_length, tags_protected_length=tags_protected_length,
tags_name=tag['name'], tags_name='Name',
tags_type=tag['type'], tags_type='Type',
tags_protected=str(tag['protected']) tags_protected='Protected'
))
for tag in sorted(domain_information['tags'], key=lambda t: t['type'] + t['name']):
ainformation.append(' {tags_name: <{tags_name_length}} {tags_type: <{tags_type_length}} {tags_protected: <{tags_protected_length}}'.format(
tags_name_length=tags_name_length,
tags_type_length=tags_type_length,
tags_protected_length=tags_protected_length,
tags_name=tag['name'],
tags_type=tag['type'],
tags_protected=str(tag['protected'])
))
else:
ainformation.append('')
ainformation.append('{purple}Tags:{end} N/A'.format(
purple=ansiprint.purple(),
bold=ansiprint.bold(),
end=ansiprint.end(),
)) ))
# Network list # Network list