Skip to content

Commit

Permalink
chore: serialise nested yaml and toml array
Browse files Browse the repository at this point in the history
  • Loading branch information
sweatybridge committed Sep 13, 2024
1 parent 6e34297 commit 9b14edb
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions internal/projects/list/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 9b14edb

Please sign in to comment.