Skip to content

Commit 1e32acb

Browse files
committed
Add suppoort for custom formatters via entrypoints.
1 parent 7c45a0a commit 1e32acb

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

snippet_fmt/__init__.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ def __init__(self, filename: PathLike, config: SnippetFmtConfigDict):
102102
self.errors = []
103103

104104
self._formatters: Dict[str, Formatter] = {
105-
# "bash": noformat,
106-
# "python": format_python,
105+
"bash": noformat,
106+
"python": format_python,
107107
"python3": format_python,
108108
"toml": format_toml,
109109
"ini": format_ini,
@@ -216,7 +216,11 @@ def _collect_error(self, match: Match[str]) -> Iterator[None]:
216216
except Exception as e:
217217
self.errors.append(CodeBlockError(match.start(), e))
218218

219-
def load_extra_formatters(self):
219+
def load_extra_formatters(self) -> None:
220+
"""
221+
Load custom formatters defined via entry points.
222+
"""
223+
220224
group = "snippet_fmt.formatters"
221225

222226
for distro_config, _ in entrypoints.iter_files_distros():

0 commit comments

Comments
 (0)