fix: stabilize directory cli output

This commit is contained in:
Peter Steinberger
2026-01-21 05:24:12 +00:00
parent e17a9c6abf
commit 36e0cffaaf

View File

@@ -225,9 +225,24 @@ export function registerDirectoryCli(program: Command) {
defaultRuntime.log(JSON.stringify(result, null, 2));
return;
}
for (const entry of result) {
defaultRuntime.log(formatEntry(entry));
if (result.length === 0) {
defaultRuntime.log(theme.muted("No group members found."));
return;
}
const tableWidth = Math.max(60, (process.stdout.columns ?? 120) - 1);
defaultRuntime.log(
`${theme.heading("Group Members")} ${theme.muted(`(${result.length})`)}`,
);
defaultRuntime.log(
renderTable({
width: tableWidth,
columns: [
{ key: "ID", header: "ID", minWidth: 16, flex: true },
{ key: "Name", header: "Name", minWidth: 18, flex: true },
],
rows: buildRows(result),
}).trimEnd(),
);
} catch (err) {
defaultRuntime.error(danger(String(err)));
defaultRuntime.exit(1);