Skip to content

feat: add JSON output for the apps command#1199

Draft
EtienneM wants to merge 1 commit intomasterfrom
feat/512/json_output
Draft

feat: add JSON output for the apps command#1199
EtienneM wants to merge 1 commit intomasterfrom
feat/512/json_output

Conversation

@EtienneM
Copy link
Member

@EtienneM EtienneM commented Mar 6, 2026

For now I just want to introduce this pattern in a single command in order to have inputs on the code organization. The purpose would be that after this PR, it's easy to slowly update the existing commands.

Fix #512

  • Add a changelog entry in the section "To Be Released" of CHANGELOG.md

@EtienneM EtienneM self-assigned this Mar 6, 2026
@EtienneM EtienneM force-pushed the feat/512/json_output branch from 1464f39 to c380ddb Compare March 6, 2026 14:13
@EtienneM EtienneM force-pushed the feat/512/json_output branch 3 times, most recently from 93340bd to 916803d Compare March 6, 2026 14:55
@EtienneM EtienneM force-pushed the feat/512/json_output branch from 916803d to 06c97b7 Compare March 6, 2026 14:58
Render(ctx context.Context, apps []*scalingo.App) error
}

func List(ctx context.Context, renderer ListRenderer, projectSlug string) error {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I like with this pattern is that the List command does not know anything about the format. It just need to calls Render.

)

func List(ctx context.Context, projectSlug string) error {
type ListRenderer interface {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I don't like is that it would require an interface per command. I don't really like that. I would love to have a single interface whatever the command. And the command only calls Render(ctx). Then we would need a way to inject the data (list of apps or anything else depending on the command) in the renderer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve scriptability of the tool by proposing JSON output

1 participant