Skip to content

feat: use OutputTable with --no-headers support in all list commands#112

Merged
Davidonium merged 5 commits intomainfrom
feat/dhernando/output-table-pattern-in-list-cmds
Apr 13, 2026
Merged

feat: use OutputTable with --no-headers support in all list commands#112
Davidonium merged 5 commits intomainfrom
feat/dhernando/output-table-pattern-in-list-cmds

Conversation

@Davidonium
Copy link
Copy Markdown
Collaborator

No description provided.

@Davidonium Davidonium requested a review from a team April 9, 2026 12:09
JustAwesomeGuy
JustAwesomeGuy previously approved these changes Apr 10, 2026
Copy link
Copy Markdown

@JustAwesomeGuy JustAwesomeGuy left a comment

Choose a reason for hiding this comment

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

Lgtm! If you rather remove the legacy PrintText in other MR feel free to merge.

Comment thread internal/cmd/base/list.go Outdated
Furthermore, removed the PrintText option in ListCmd to avoid
inconsistencies.
Also updated AGENTS.md with up to date examples.
Comment thread internal/cmd/base/list.go
Short string
Long string
Example string
Args cobra.PositionalArgs // optional; defaults to cobra.NoArgs
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The cluster key list command required an argument, thus defaulting to NoArgs but allowing clients to set them if needed.

)

func newKeyListCommand(s *state.State) *cobra.Command {
return base.DescribeCmd[*clusterauthv2.ListDatabaseApiKeysResponse]{
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This was a hack to get the argument, fixed.

Comment on lines -229 to -242
func TestListClusters_NextPageTokenPrintedAsFooter(t *testing.T) {
env := testutil.NewTestEnv(t)

token := "footer-token"
env.Server.ListClustersCalls.Returns(&clusterv1.ListClustersResponse{
Items: []*clusterv1.Cluster{{Id: "cluster-1"}},
NextPageToken: &token,
}, nil)

stdout, _, err := testutil.Exec(t, env, "cluster", "list", "--page-size", "1")
require.NoError(t, err)

assert.Contains(t, stdout, "Next page token: footer-token")
}
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Printing the next token was breaking the pattern for the rest of the tables. Also most CLIs don't print it when printing in plain text. The next token is present when passing --json in most CLIs, will do the same in ours.

Copy link
Copy Markdown

@JustAwesomeGuy JustAwesomeGuy left a comment

Choose a reason for hiding this comment

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

lgtm!

@Davidonium Davidonium merged commit bc23a1f into main Apr 13, 2026
7 checks passed
@Davidonium Davidonium deleted the feat/dhernando/output-table-pattern-in-list-cmds branch April 13, 2026 12:53
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.

2 participants