diff --git a/src/ldaptool/decode/_decoder.py b/src/ldaptool/decode/_decoder.py index 3027f44..43e4212 100644 --- a/src/ldaptool/decode/_decoder.py +++ b/src/ldaptool/decode/_decoder.py @@ -199,13 +199,19 @@ class Decoder: return decoded_entry def human(self, *, dn: str, obj: TDecoded) -> dict[str, str]: + emit: dict[str, typing.Any] = dict(dn=dn) + for name, attrs in obj.items(): + emit[name] = self.arguments.human_separator.join(attr.human() for attr in attrs) + return emit + + def simple_json(self, *, dn: str, obj: TDecoded) -> dict[str, str]: emit: dict[str, typing.Any] = dict(dn=dn) for name, attrs in obj.items(): emit[name] = [attr.human() for attr in attrs] return emit def emit_simple_json(self, *, dn: str, obj: TDecoded, file: typing.IO[str] = sys.stdout) -> None: - emit = self.human(dn=dn, obj=obj) + emit = self.simple_json(dn=dn, obj=obj) json.dump(emit, file, ensure_ascii=False) print(file=file) # terminate output dicts by newline