From 9b14edb306cedf4fd664bdc90f3d9f38e80bab46 Mon Sep 17 00:00:00 2001 From: Qiao Han Date: Fri, 13 Sep 2024 12:30:23 +0800 Subject: [PATCH] chore: serialise nested yaml and toml array --- internal/projects/list/list.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/internal/projects/list/list.go b/internal/projects/list/list.go index 55df100fd..b16b6d4fc 100644 --- a/internal/projects/list/list.go +++ b/internal/projects/list/list.go @@ -15,8 +15,8 @@ import ( ) type linkedProject struct { - api.V1ProjectResponse - Linked bool `json:"linked"` + api.V1ProjectResponse `yaml:",inline"` + Linked bool `json:"linked"` } func Run(ctx context.Context, fsys afero.Fs) error { @@ -57,8 +57,13 @@ func Run(ctx context.Context, fsys afero.Fs) error { utils.FormatTimestamp(project.CreatedAt), ) } - return list.RenderTable(table) + } else if utils.OutputFormat.Value == utils.OutputToml { + return utils.EncodeOutput(utils.OutputFormat.Value, os.Stdout, struct { + Projects []linkedProject `toml:"projects"` + }{ + Projects: projects, + }) } return utils.EncodeOutput(utils.OutputFormat.Value, os.Stdout, projects)