diff options
| author | jvoisin | 2018-10-05 12:42:51 +0200 |
|---|---|---|
| committer | jvoisin | 2018-10-05 12:43:21 +0200 |
| commit | d0f3534efffb057e0f6a5decde70d96b6c98cab8 (patch) | |
| tree | edec619c1498c64353931ac62d9aefbd471128d8 | |
| parent | 8675706c9385f9a085bfbe568636ee878f68bef1 (diff) | |
Hide unsupported extensions in `mat2 -l`
| -rw-r--r-- | libmat2/parser_factory.py | 1 | ||||
| -rwxr-xr-x | mat2 | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/libmat2/parser_factory.py b/libmat2/parser_factory.py index 8bca081..621640b 100644 --- a/libmat2/parser_factory.py +++ b/libmat2/parser_factory.py | |||
| @@ -33,6 +33,7 @@ def _get_parsers() -> List[T]: | |||
| 33 | 33 | ||
| 34 | 34 | ||
| 35 | def get_parser(filename: str) -> Tuple[Optional[T], Optional[str]]: | 35 | def get_parser(filename: str) -> Tuple[Optional[T], Optional[str]]: |
| 36 | """ Return the appropriate parser for a giver filename. """ | ||
| 36 | mtype, _ = mimetypes.guess_type(filename) | 37 | mtype, _ = mimetypes.guess_type(filename) |
| 37 | 38 | ||
| 38 | _, extension = os.path.splitext(filename) | 39 | _, extension = os.path.splitext(filename) |
| @@ -96,7 +96,7 @@ def show_parsers(): | |||
| 96 | for mtype in parser.mimetypes: | 96 | for mtype in parser.mimetypes: |
| 97 | extensions = set() | 97 | extensions = set() |
| 98 | for extension in mimetypes.guess_all_extensions(mtype): | 98 | for extension in mimetypes.guess_all_extensions(mtype): |
| 99 | if extension[1:] not in UNSUPPORTED_EXTENSIONS: # skip the dot | 99 | if extension not in UNSUPPORTED_EXTENSIONS: |
| 100 | extensions.add(extension) | 100 | extensions.add(extension) |
| 101 | if not extensions: | 101 | if not extensions: |
| 102 | # we're not supporting a single extension in the current | 102 | # we're not supporting a single extension in the current |
