1
0
mirror of synced 2024-11-22 17:24:23 +01:00

Sort the output of mat2 -l

This commit is contained in:
jvoisin 2018-06-04 23:32:13 +02:00
parent 6a1b0b31f0
commit 8368de7fa7
2 changed files with 5 additions and 3 deletions

View File

@ -1,6 +1,6 @@
import abc import abc
import os import os
from typing import Set from typing import Set, Dict
assert Set # make pyflakes happy assert Set # make pyflakes happy
@ -15,7 +15,7 @@ class AbstractParser(abc.ABC):
self.output_filename = fname + '.cleaned' + extension self.output_filename = fname + '.cleaned' + extension
@abc.abstractmethod @abc.abstractmethod
def get_meta(self) -> dict: def get_meta(self) -> Dict[str, str]:
pass pass
@abc.abstractmethod @abc.abstractmethod

4
mat2
View File

@ -72,6 +72,7 @@ def clean_meta(params: Tuple[str, bool]) -> bool:
def show_parsers(): def show_parsers():
print('[+] Supported formats:') print('[+] Supported formats:')
formats = list()
for parser in parser_factory._get_parsers(): for parser in parser_factory._get_parsers():
for mtype in parser.mimetypes: for mtype in parser.mimetypes:
extensions = set() extensions = set()
@ -82,7 +83,8 @@ def show_parsers():
# we're not supporting a single extension in the current # we're not supporting a single extension in the current
# mimetype, so there is not point in showing the mimetype at all # mimetype, so there is not point in showing the mimetype at all
continue continue
print(' - %s (%s)' % (mtype, ', '.join(extensions))) formats.append(' - %s (%s)' % (mtype, ', '.join(extensions)))
print('\n'.join(sorted(formats)))
def __get_files_recursively(files): def __get_files_recursively(files):