tools/compress-png: migration to python typos

Allow --list to run with no other options
Loop through all compressors checking if they exist
Add filename for searching in IDE
This commit is contained in:
Chuck Craft 2022-10-25 00:17:56 -05:00 committed by Gerald Combs
parent 974123c507
commit 978def5b51
1 changed files with 3 additions and 3 deletions

View File

@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
# Compress PNGs
# compress-pngs.py - Compress PNGs
#
# By Gerald Combs <gerald@wireshark.org
#
@ -42,7 +42,7 @@ def get_compressors():
def compress_png(png_file, compressors):
for compressor in compressors:
if not compressors[compressor].get('path', False):
next
continue
args = compressors[compressor]['args']
args = [arg.replace(PNG_FILE_ARG, png_file) for arg in args]
@ -57,7 +57,7 @@ def main():
parser = argparse.ArgumentParser(description='Compress PNGs')
parser.add_argument('--list', action='store_true',
help='List available compressors')
parser.add_argument('png_files', nargs='+', metavar='png file', help='Files to compress')
parser.add_argument('png_files', nargs='*', metavar='png file', help='Files to compress')
args = parser.parse_args()
compressors = get_compressors()